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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
TestTest17891
Advocate I
Advocate I

Create a DAX expression to count the non-blank rows in a table based on a specific condition

How can I formulate a DAX expression that filters a table based on conditions in two different columns and then counts the remaining rows in Power BI ?

measure = CALCULATE (
COUNTROWS( df )
,df[column1] IN { "col1", "col2", "col2" }
&&df[column2] <> 0
)

1 ACCEPTED SOLUTION
AmiraBedh
Resident Rockstar
Resident Rockstar

Try the following : 

 

measure =  CALCULATE (
           COUNTROWS( df )
                  ,df[column1] IN { "col1", "col2", "col2" } 
                 && VALUE(df[column2]) <> 0
        )

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

1 REPLY 1
AmiraBedh
Resident Rockstar
Resident Rockstar

Try the following : 

 

measure =  CALCULATE (
           COUNTROWS( df )
                  ,df[column1] IN { "col1", "col2", "col2" } 
                 && VALUE(df[column2]) <> 0
        )

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.