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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
BITomS
Responsive Resident
Responsive Resident

Use Max Date Month From Fact Table in Prior Years in Matrix

Hi all,

This problem is a blocker to a wider calculation (YTD measure), but am just showing this specific part in the hope to make it easier to resolve.

I have a number of years in my matrix table and want to identify the Max Month in the current year (i.e. May 2024 which is showing correctly as 5 below), but also apply this same month to previous years to make it dynamic. However, for the previous years, the YTD month returned is for the full year i.e. 12.

 

Please may someone help me understand how I can ensure 2022 and 2023 years also show 5 instead of 12?

FYI, the max date is taken from a fact table (DailyConsumptions), not a Date dimension table, although a date dimension table does exist in the model.

 

BITomS_0-1718289017572.png

 

1 ACCEPTED SOLUTION
BITomS
Responsive Resident
Responsive Resident

Fixed it myself:

VAR _Month = MONTH(calculate(max(DailyConsumptions[Date]),removefilters('Date')))

View solution in original post

1 REPLY 1
BITomS
Responsive Resident
Responsive Resident

Fixed it myself:

VAR _Month = MONTH(calculate(max(DailyConsumptions[Date]),removefilters('Date')))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.