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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Snehasishsar
New Member

How to get the total for dynamic measures

Hello Friends,

I have a table (Table 1) where the "Threshold “values are coming from a parameter(which user can change) and for employees where the salary(Data Column) is less than "Threshold", we have to calculate the additional cost for that employee and then the total of these additional costs.

However, if you see table 2(powerbi output), the additional cost at the employee level is getting calculated correctly, but however for the total of these additional costs , the aggregation is not happening at a column level.

Instead it is considering the column totals of salary and "Threshold" to compute the Total of these additional Cost. Refer to the screenshot below

 

The desired result for "Total of these Addtional cost"  is 9500 and not 4500. 

 

Any help to achieve the result as shown in the desired table would be highly appreciated. 🙂 🙂 

 

screenshot.JPG

 

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Additional Cost = SUMX(DISTINCT('Table'[EmpID]),CALCULATE(IF(MAX('Table'[Salary])>=[Threshold Value],0,[Threshold Value]-MAX('Table'[Salary]))))

When you select one value in Threshold slicer, the result shows:

36.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Additional Cost = SUMX(DISTINCT('Table'[EmpID]),CALCULATE(IF(MAX('Table'[Salary])>=[Threshold Value],0,[Threshold Value]-MAX('Table'[Salary]))))

When you select one value in Threshold slicer, the result shows:

36.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

amitchandak
Super User
Super User

Try a new measure like

additional Cost 1=

sumx(summarize(table, table[emp id],"_sum",[additional Cost]),[_sum])

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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