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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wdrain
Helper I
Helper I

Row Counts based on field parameters selections

Could someone help me with a dax calculation that counts uses the countrows functions based on field parameter selection menu.

based on the screenshot below it would need to do a row count based using a dynamic filter based on the menu selection and count the rows that all equal 1. the dax caculation would need to equal the values in the compliant and non-compliant boxes

image.pngimage.png

6 REPLIES 6
wdrain
Helper I
Helper I

Ok This is what I came up with for the compliance count based on the selection, but know there gotta be a better way. Does anyone know how to code this more efficently?

image.png

 

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


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

Hi Ashish

I was'n able to share a download link of the pbi file, but I did post screenshots of the datamodel of the pbix file.

I hope that helps.

Screenshots do not help.


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

@wdrain , Assume your measure is M1 used in visual  , and your axis /row/group by is column1

 

compliant =

_var count = countrows(values(Table[Software]))

return

sumx( Values(Table[Column1]) , if( calculate(SUmx(Values([Software]),[M1])) =_var, 1, blank() ) )

 

 

Non compliant =

_var count = countrows(values(Table[Software]))

return

sumx( Values(Table[Column1]) , if( calculate(SUmx(Values([Software]),[M1])) =0, 1, blank() ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amitchandak

Thanks for the dax formula, but I don't think it applies to my datamodel or I am not sure on how to adjust to make it apply.

I don't have the permission to share my pbix file, but I can share screenshot of the sample data and the datamodel.

As mentioned earlier, I'm looking for a Compliant and Non Compliant count based the slicer selection 
Compliant count should be when all software selection equal 1 

image.pngimage.pngimage.pngimage.pngimage.pngimage.png

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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