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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
edcdcpowerbi
Helper I
Helper I

Calculate with measures

 
I am trying to create a measure which returns all 'ClientIDs' with a higher final score. 
I have Two measures 'Initial Score' & 'Final Score, the DAX for them is below 
 

CALCULATE(SUM('Client')'[Total Score]),'Client[Stage] = "Final")

CALCULATE(SUM('Client')'[Total Score]),'Client[Stage] = "Initial")

 

 

I now wish to create measure the third measure which return all the 'ClientIDs' that have a higher final score.

A bit lost on how to go about it, this is what i currently have which does not work. 

Would appreciate any help and advice

 

CALCULATE( COUNT( 'Client'[ID]) , [Final Score] > [Initial Score] )

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@edcdcpowerbi ,

 

Try like

CALCULATE( COUNTX(filter(values( 'Client'[ID]) , [Final Score] > [Initial Score] ), [Client ID] ))

 

if needed add a filter in these two too

CALCULATE(SUM('Client')'[Total Score]),filter('Client , 'Client[Stage] = "Final"))

CALCULATE(SUM('Client')'[Total Score]),filter('Client , 'Client[Stage] = "Initial") )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@edcdcpowerbi ,

 

Try like

CALCULATE( COUNTX(filter(values( 'Client'[ID]) , [Final Score] > [Initial Score] ), [Client ID] ))

 

if needed add a filter in these two too

CALCULATE(SUM('Client')'[Total Score]),filter('Client , 'Client[Stage] = "Final"))

CALCULATE(SUM('Client')'[Total Score]),filter('Client , 'Client[Stage] = "Initial") )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thankyou, that works perfectly, are you ok to give a breakdown as to what is happening in the measure, I'm new to DAX so would love to understand more!

Anonymous
Not applicable

We have basically three functions at work here. Separated by colour.

COUNTX(filter(values( 'Client'[ID]) , [Final Score] > [Initial Score] ), [Client ID] ))

Let's break it down from the innermost arguments:

  • values( 'Client'[ID]) - gives us a list of unique values from the column 'Client'[ID]

  • filter(values( 'Client'[ID]) , [Final Score] > [Initial Score] ) - Now that we have a list of unique values of 'Client'[ID], we filtered these values where the condition '[Final Score] > [Initial Score]' holds true using the filter() function.
  • COUNTX(filter(values( 'Client'[ID]) , [Final Score] > [Initial Score] ), [Client ID] )) - This function simply gives the count of the filtered values of 'Client'[ID] received from the filter() function mentioned above.

In this we we find the count of 'Client'[ID]) where [Final Score] > [Initial Score].

In case you need to understand in detail each of these functions you can use dax.guide 
Hope this helps.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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