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
Anonymous
Not applicable

Dynamic Measure depends on slicer value

Hi Power BI community,

I developed a measure column for calculating a cumulative data as per below code:

Cumulative Actual MH  =
 CALCULATE (sum ( 'PBI LabourCode_Actual'[Project Job numberMH] ),
 FILTER 
(ALL ( 'PBI LabourCode_Actual')
,'PBI LabourCode_Actual'[WorkDate] <= MAX ( 'PBI LabourCode_Actual'[WorkDate] )))

I want this measure to be depended to a slicer selection for Job Numbers (

PBI LabourCode_Actual'[Project Job numberMH])

, but so far I couldnt find anything to work . any suggestion? the job number values and measure column are  all in a same table. 

 

Really appreciate your help

1 ACCEPTED SOLUTION

If you have a one to many relationship between Date and WorkDate (so the arrow is pointing from Date to WorkDate) you should be able to use the Date column to filter the 'PBI LabourCode_Actual' table. 

 

In fact the typically pattern for building a cumulative "life to date" measure would be to use your date table in the filter.

 

eg.

 

Cumulative Actual MH =
CALCULATE (sum ( 'PBI LabourCode_Actual'[Project Job numberMH] ),
FILTER (ALL ( 'Date')
,'Date'[Date] <= MAX ( 'Date'[Date] )))

 

Then slicers on any other tables should work normally.

View solution in original post

5 REPLIES 5
d_gosbell
Super User
Super User

The probem is that you are using ALL('PBI LabourCode_Actual') which will remove all filters including slicers. If you change your expression just to do ALL over the WorkDate column it should still calculate correctly, but also work with your Job Number slicer.

 

Cumulative Actual MH  =
 CALCULATE (sum ( 'PBI LabourCode_Actual'[Project Job numberMH] ),
 FILTER 
(ALL ( 'PBI LabourCode_Actual'[WorkDate])
,'PBI LabourCode_Actual'[WorkDate] <= MAX ( 'PBI LabourCode_Actual'[WorkDate] )))

 

Anonymous
Not applicable

I applied your formula, but it didnt return the correct value. It returnes the Actual Manhour and not its cumulative  ! Look at the below table. I named your formula as Cumulative actual - NewCumulative.PNG

 

What's that "Date" column on the rows? Is that WorkDate or some other date?

 

You could try using ALLEXCEPT and excluding the column you are using for your slicer? (is it really [Project Job numberMH] as it seems strange to try to sum and filter by the one column?)

 

Cumulative Actual MH  =
 CALCULATE (sum ( 'PBI LabourCode_Actual'[Project Job numberMH] ),
 FILTER 
(ALLEXCEPT ( 'PBI LabourCode_Actual', 'PBI LabourCode_Actual'[Project Job numberMH])
,'PBI LabourCode_Actual'[WorkDate] <= MAX ( 'PBI LabourCode_Actual'[WorkDate] )))

This is the problem with having all your data in one big table. Having a separate 'Date' table makes things like cumulative sums a lot easier.

Anonymous
Not applicable

Ok, I think I know what the issue is . The Date" column on the rows is not WorkDate. Actually it is date from a calendar table that I created and made a relationship between it and WorkDate. I changed the rows to WorkDate and the formula is working now.

 

However, for some reason I want to use calendar date for columns not WorkDate. any suggestion?

If you have a one to many relationship between Date and WorkDate (so the arrow is pointing from Date to WorkDate) you should be able to use the Date column to filter the 'PBI LabourCode_Actual' table. 

 

In fact the typically pattern for building a cumulative "life to date" measure would be to use your date table in the filter.

 

eg.

 

Cumulative Actual MH =
CALCULATE (sum ( 'PBI LabourCode_Actual'[Project Job numberMH] ),
FILTER (ALL ( 'Date')
,'Date'[Date] <= MAX ( 'Date'[Date] )))

 

Then slicers on any other tables should work normally.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors