DAX Occurrences of count

0 votes

So I have a table;

Now, I want to apply some dax instructions to that table, and display this data in a chart. In other words,  if it is the first time that the Country's name appears, it must show 1 and 2 for the second time.

Can anybody help me? Thanks.

Nov 22, 2018 in Power BI by Shubham
• 13,490 points
5,706 views

1 answer to this question.

0 votes

Try this for creating a calculated column called Occurrences:

Occurrences =
CALCULATE (
    COUNT ( [Pais] ),
    FILTER (
        'Table',
        [Index] <= EARLIER ( 'Table'[Index] )
            && [Pais] = EARLIER ( 'Table'[Pais] )
    )
)

Index must be an incremental key in each row.

Let me know if this helps.

answered Nov 22, 2018 by Upasana
• 8,620 points
Hi,

This dax is taking too much time. I  tried on a data which has 5lakhs+ rows and the dax is showing 'working on it' for like half an hour.
Can you please help with some other similar dax function.

Hi, @Sandeep,

The COUNTROWS function counts the number of rows in the specified table, or in a table defined by an expression.

Syntax: COUNTROWS(<table>)

This function can be used to count the number of rows in a base table, but more often is used to count the number of rows that result from filtering a table, or applying context to a table.

Whenever there are no rows to aggregate, the function returns a blank. However, if there are rows, but none of them meet the specified criteria, the function returns 0. Microsoft Excel also returns zero if no rows are found that meet the conditions.

=COUNTROWS('Orders')

I hope this explanation will help.

Related Questions In Power BI

0 votes
1 answer

Count occurrences in DAX

You can use DAX functions to do ...READ MORE

answered Mar 9, 2019 in Power BI by Avantika
• 1,520 points
26,295 views
0 votes
1 answer

Max count of workspaces per one PRO user

Right now, it is 250, will be ...READ MORE

answered Sep 24, 2018 in Power BI by Hannah
• 18,540 points
691 views
0 votes
1 answer

Calculating MoM Variance of a Measure Field using DAX

Create an intermediate calculated column that considers ...READ MORE

answered Feb 28, 2019 in Power BI by Shubham
• 13,490 points
7,100 views
0 votes
1 answer

Add Column Count_of_people across two tables to get the count of people from a city.

Hi Anitha, 1. Merge both tables, using City ...READ MORE

answered Mar 22, 2019 in Power BI by Cherukuri
• 33,030 points
1,125 views
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,220 points

edited Oct 11, 2018 by Kalgi 2,421 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
1,137 views
0 votes
2 answers

Power BI Dax Multiple IF AND Statements

HI I have Column Patient 12 13 14 15 18 IN Patient=12, 13 Out ...READ MORE

answered May 23, 2019 in Power BI by VNK
18,894 views
0 votes
1 answer

Distinct count filtered by condition using Power BI Dax

Try this, it should work: DistinctCountActiveMonths = CALCULATE( ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
37,590 views
0 votes
1 answer

Dax: Sum of values from many columns in a row

Yes, you can. Try to "Unpivot other columns" ...READ MORE

answered Apr 3, 2019 in Power BI by Upasana
• 8,620 points
10,389 views
0 votes
1 answer

Calculate Time Intersection to Correlate Sequences of Independent Events

I think this solution requires a CROSS JOIN implementation. ...READ MORE

answered Oct 26, 2018 in Power BI by Upasana
• 8,620 points
773 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP