Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
souvik900766
Helper IV
Helper IV

Count rows on the basis of If condition output !

Hi !
My data link:-https://www.dropbox.com/s/qww6kbl4ytb70aw/Count%20rows.pbix?dl=0

 

I want to count rows on the basis of a measure made out of if condition.
My condition will return L, C, E and need to count them that how many country falls under each.

I used this measure to count rows:-

E Count Brand View = COUNTROWS(FILTER(VALUES(MSR[ctry_nm]),[LCE Brand View]="E"))
This measure is working only when I am keeping the ctgry_nm column and removing brnd_nm then it is returning 5 which is correct but keeping both column it woluld return 8 which is correct.

Capture 3.PNG

Thanks in advance !

1 ACCEPTED SOLUTION

Hi,

Try this measure

COUNTROWS(FILTER(SUMMARIZE(GENERATE(VALUES(MSR[ctry_nm]),VALUES(MSR[brnd_nm])),MSR[ctry_nm],MSR[brnd_nm],"ABCD",[LCE Brand View]),[ABCD]="L"))

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Measure = COUNTROWS(FILTER(SUMMARIZE(MSR,MSR[brnd_nm],MSR[ctry_nm],"ABCD",[LCE Brand View]),[ABCD]="E"))

Untitled.png 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 
I used your DAX it is showing blank in my original file !!!🤔

Capture 5.PNG

Hi,

I have no idea why.  As you can clearly see, in the file that you uploaded, my formula is giving the correct result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 
Kindly check the dashboard for once.
https://www.dropbox.com/s/imw6h6mspnufty5/Count%20rows.pbix?dl=0
Numbers are showing blank or wrong !
Capture 10.PNG
Thanks in advance !

Hi,

Try this measure

COUNTROWS(FILTER(SUMMARIZE(GENERATE(VALUES(MSR[ctry_nm]),VALUES(MSR[brnd_nm])),MSR[ctry_nm],MSR[brnd_nm],"ABCD",[LCE Brand View]),[ABCD]="L"))

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@souvik900766 , Try a measure like

E Count Brand View = COUNTROWS(FILTER(MSR,[LCE Brand View]="E"))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors