Reply
NewbieJono
Post Partisan
Post Partisan
Partially syndicated - Outbound

Year To Max Date

is there a method of doing a year to max date in a fact table.

 

i need the year to start 01/04 and I need to calculate volumes to the max date of another dateset.

 

i will also need to do a same period previous year on this metric.

1 ACCEPTED SOLUTION

Syndicated - Outbound

Like this:

InScope = 
VAR _MaxFromFactTable = MAX( YOUR_FACT_TABLE[Date] )
RETURN
    IF(
        'Calendar Table'[Date] <= _MaxFromFactTable,
        1,
        0
    )


Good luck! 🙂

View solution in original post

3 REPLIES 3
Sergii24
Super User
Super User

Syndicated - Outbound

You can add a calculated column "InScope" to you Calendar Table that will compare date of a current row with max date from forct table. Once you have it, you can make a desired calculation using this template code:

Measure1 = 
VAR _CurrentlySelectedMinDate = Min( CalendarTable[Date] )
   Calculate(
      Your_calcuation,
      CalendarTable[Date] >= _CurrentlySelectedMinDate,
      CalendarTable[InScope] = 1
   )

I hope it helps!

Syndicated - Outbound

how would i do the in scope calculation?

Syndicated - Outbound

Like this:

InScope = 
VAR _MaxFromFactTable = MAX( YOUR_FACT_TABLE[Date] )
RETURN
    IF(
        'Calendar Table'[Date] <= _MaxFromFactTable,
        1,
        0
    )


Good luck! 🙂

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)