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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
spandy34
Responsive Resident
Responsive Resident

DAX Query

I have the DAX below to create a measure that

 

- find those calls where the Planned Duration  = 15 mins and the Delivered Duration is between 0 and 17 mins, and then total the Test Cost and multiply by Delivered Duration Decimal - can you see anything wrong with below?  Its doing the first part just not multiplying the answer by the Delivered Duration Decimal

 

spandy34_0-1682003835989.png

 

 

"DAX - 

Test New = CALCULATE(SUM('Procurement_Main_Data'[Test Cost]),'Procurement_Main_Data'[Planned Duration] = TIMEVALUE ("00:15") &&'Procurement_Main_Data'[Delivered Duration]>= TIMEVALUE("00:00")&& 'Procurement_Main_Data'[Planned Duration]<= TIMEVALUE("00:17")*('Procurement_Main_Data'[Delivered Duration Decimal]))   "
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@spandy34 

Let me assume that you are working at row level of source data table. In this case please try

Test New =
SUMX (
FILTER (
'Procurement_Main_Data',
'Procurement_Main_Data'[Planned Duration] = TIMEVALUE ( "00:15" )
&& 'Procurement_Main_Data'[Delivered Duration] >= TIMEVALUE ( "00:00" )
&& 'Procurement_Main_Data'[Planned Duration] <= TIMEVALUE ( "00:17" )
),
'Procurement_Main_Data'[Test Cost] * 'Procurement_Main_Data'[Delivered Duration Decimal]
)

View solution in original post

12 REPLIES 12
tamerj1
Super User
Super User

@spandy34 

Let me assume that you are working at row level of source data table. In this case please try

Test New =
SUMX (
FILTER (
'Procurement_Main_Data',
'Procurement_Main_Data'[Planned Duration] = TIMEVALUE ( "00:15" )
&& 'Procurement_Main_Data'[Delivered Duration] >= TIMEVALUE ( "00:00" )
&& 'Procurement_Main_Data'[Planned Duration] <= TIMEVALUE ( "00:17" )
),
'Procurement_Main_Data'[Test Cost] * 'Procurement_Main_Data'[Delivered Duration Decimal]
)

spandy34
Responsive Resident
Responsive Resident

Thats worked !! Thank you so much your a star.

spandy34
Responsive Resident
Responsive Resident

Ive took a braket out and got rid of the error but the Test New still doesnt say 0.56

 

spandy34_1-1682009006376.png

 

tamerj1
Super User
Super User

Hi @spandy34 

please try

Test New =
CALCULATE (
SUM ( 'Procurement_Main_Data'[Test Cost] ),
'Procurement_Main_Data'[Planned Duration] = TIMEVALUE ( "00:15" )
&& 'Procurement_Main_Data'[Delivered Duration] >= TIMEVALUE ( "00:00" )
&& VALUE ( 'Procurement_Main_Data'[Planned Duration] )
<= VALUE ( TIMEVALUE ( "00:17" ) ) * ( 'Procurement_Main_Data'[Delivered Duration Decimal] )
)

spandy34
Responsive Resident
Responsive Resident

Thank you @tamerj1 for responding.

 

I have tried the DAX and I am getting 0.28 and I should be getting 0.56 - see below

 

spandy34_0-1682007613471.png

 

@spandy34 

If you place the measure in the table, does it give the same value?

spandy34
Responsive Resident
Responsive Resident

Yes -

 

spandy34_0-1682008023310.png

 

@spandy34 

Perhaps you mean

Test New =
CALCULATE (
SUM ( 'Procurement_Main_Data'[Test Cost] ),
'Procurement_Main_Data'[Planned Duration] = TIMEVALUE ( "00:15" )
&& 'Procurement_Main_Data'[Delivered Duration] >= TIMEVALUE ( "00:00" )
&& 'Procurement_Main_Data'[Planned Duration] <= TIMEVALUE ( "00:17" )
) * 'Procurement_Main_Data'[Delivered Duration Decimal]

?

spandy34
Responsive Resident
Responsive Resident

Ive tried ? and ) at the end of the DAX and get these errors

 

spandy34_1-1682008467711.png

 

 

spandy34_0-1682008420943.png

 

@spandy34 

Lol 

please delete the question mark. 

spandy34
Responsive Resident
Responsive Resident

I get this error now

 

spandy34_0-1682008768528.png

 

@spandy34 

Ok so this a summarized column not a measure. Is it summarized by sum?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.