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
sivasahit
New Member

How to sum the values generated based on Condition

Hi ,

  Can any one help me in solving the below issue.

Summary of the issue:

I am having a below Table visualization in Power BI  where I need to create a measure “Expected Result(160) “  in such a way that

 if “Actual Total Hours” is greater than 160 then I should display 160 else I should display the original value .

 

Logic used:

 

Actual Total hours= TAW hours + Billable hours+ Maintenance hours

Expected Result(160)= if([Actual Total hours]>160,160, [Actual Total hours])

 

Expected Result:

Expected Result.JPG

Problem :

The above logic is working fine for each row, but when it is coming to Total it is not summarizing the values like other columns , instead displaying 160 like in below image.

 

Note1: All the above number columns are not readily available in database , I have created in Power BI.

Note2: I have used measure for all the above calculations as I am getting circular dependency error if I am creating calculation in Column.

Current Result:

Current Result.JPG

1 REPLY 1
VasTg
Memorable Member
Memorable Member

@sivasahit 

 

Use the below measures to get the correct totals.

 

Actual Total Hours = SUM(Test[TAW Hours])+SUM(Test[Bill Hrs])+SUM(Test[Maint Hrs])
 
New Expected Result  =
CALCULATE(SUMX(ADDCOLUMNS(SUMMARIZE(Test,Test[Dep],Test[Name]),"New",IF([Actual Total Hours]>160,160,[Actual Total Hours])),[New]))
 
Replace the Entity and column names.
Capture4.PNG
If this helps, mark the answer as solution.
Kudos are nice too.
 
 
Connect on LinkedIn

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.