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
Kimcha
Advocate I
Advocate I

Use slicer value in a measure

Hi, 

 

I have a report that is showing data on a week number basis. I have two slicers that allow me to select the year & week.

 

The data below shows the sales stats only within that week.

 

But I would like to add a few year-to-date measures to that report page, which start from the selected year until the last day of the week.

 

My plan is to create a table visual that has only has an interaction with the year slicer, but not with the week slicer.

 

But then I still nead to create a YTD measure that somehow limits the calculation up to max(week_slicer).

 

Any ideas of how I could accomplish this?

1 ACCEPTED SOLUTION
Kimcha
Advocate I
Advocate I

Actually, I think I just figured it out, but perhaps you could help me guide on whether that is the ideal way of doing it.

 

I created the following measure:

YTD - Total Revenue = var selected_week = MAX(BasicCalendarEnglishDynamic[ISO WeekNumber]) RETURN CALCULATE(SUM('IS Orders'[TotalDue]), ALL(BasicCalendarEnglishDynamic[ISO WeekNumber]), BasicCalendarEnglishDynamic[ISO WeekNumber] <= selected_week)

And I abondoned my initial idea of disabling interaction for that specific visiual.

View solution in original post

1 REPLY 1
Kimcha
Advocate I
Advocate I

Actually, I think I just figured it out, but perhaps you could help me guide on whether that is the ideal way of doing it.

 

I created the following measure:

YTD - Total Revenue = var selected_week = MAX(BasicCalendarEnglishDynamic[ISO WeekNumber]) RETURN CALCULATE(SUM('IS Orders'[TotalDue]), ALL(BasicCalendarEnglishDynamic[ISO WeekNumber]), BasicCalendarEnglishDynamic[ISO WeekNumber] <= selected_week)

And I abondoned my initial idea of disabling interaction for that specific visiual.

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.