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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Preeti_Yadav
Resolver I
Resolver I

IF returning Incorrect totals

Hi .

I am calculating Amount using 

 

Amount=

IF(

FIRSTNONBLANK('HRDataSen DaxLaborDetail'[OTMult],0)=1.00,

SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate]),

(SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate]))/1.5.

My individual row values are returning correct output,however it is giving me incorrect totals.
I tried wrapping it under SUMX but to no avail.

Thanks,
Preeti

1 ACCEPTED SOLUTION

@Preeti_Yadav what is the granularity?
Like each row has a unique value in ADPworklocationdescroption column or it's a combination of also EmployeeID and ApplyDate.
Anyway try:

Amount =
SUMX (
    SUMMARIZE (
        'Table Name',
        'Table Name'[ADPworklocationdescroption],
        'Table Name'[EmployeeID],
        'Table Name'[ApplyDate]
    ),
    CALCULATE(
    	IF(
			
			FIRSTNONBLANK('HRDataSen DaxLaborDetail'[OTMult],0)=1.00,
			
			SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate]),
			
			SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate])/1.5
		)
		
	)
)


Will apprecuiate Your Kudos on my messages 🙂

View solution in original post

3 REPLIES 3
SpartaBI
Community Champion
Community Champion

@Preeti_Yadav SUMX should be the solution for that, but need to see how exacty you used it in the visual.
Can you give more info about how the visual looks like and what are the names of the column in play in that visual.

Hi   

below is the provided screenshot , please have a look

 

 

Preeti_Yadav_0-1655982362470.jpeg

@SpartaBI

 

regards,

Preeti Yadav

@Preeti_Yadav what is the granularity?
Like each row has a unique value in ADPworklocationdescroption column or it's a combination of also EmployeeID and ApplyDate.
Anyway try:

Amount =
SUMX (
    SUMMARIZE (
        'Table Name',
        'Table Name'[ADPworklocationdescroption],
        'Table Name'[EmployeeID],
        'Table Name'[ApplyDate]
    ),
    CALCULATE(
    	IF(
			
			FIRSTNONBLANK('HRDataSen DaxLaborDetail'[OTMult],0)=1.00,
			
			SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate]),
			
			SUM('HRDataSen DaxLaborDetail'[WorkedHours])*SUM('HRDataSen DaxLaborDetail'[CalcRate])/1.5
		)
		
	)
)


Will apprecuiate Your Kudos on my messages 🙂

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.