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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mra1984
Helper II
Helper II

PBI measure to only divide the last available date

I want to divide the last month's data but I can't use last month as sometimes we are not able to update for a few months. I came up with this which doesn't work: Partipation_value_month = FILTER(raw,max(raw[Date]) RETURN DIVIDE( CALCULATE(SUM(raw[Value]),raw[Online/TE]="Online"), CALCULATE(SUM(raw[Value]),raw[Online/TE]="TE")) The bit after DIVIDE works for what I want but I don't know how to filter for the last month's read max(raw[Date) works on it's own but how to integrate into this existing measure? Thanks

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @mra1984 ,

 

You need to put filter in the calculate query. You could try this DAX:

DIVIDE (
    CALCULATE (
        SUM ( raw[Value] ),
        raw[Online/TE] = "Online",
        FILTER ( raw, MAX ( raw[Date] ) )
    ),
    CALCULATE (
        SUM ( raw[Value] ),
        raw[Online/TE] = "TE",
        FILTER ( raw, MAX ( raw[Date] ) )
    )
)

Or

A =
VAR a =
    FILTER ( raw, MAX ( raw[Date] ) )
RETURN
    DIVIDE (
        CALCULATE ( SUM ( raw[Value] ), raw[Online/TE] = "Online", a ),
        CALCULATE ( SUM ( raw[Value] ), raw[Online/TE] = "TE", a )
    )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

The formula is accepted but nothing is actually being filtered for some reason 

mra1984
Helper II
Helper II

Basically I want this measure but for the last month only (via max date) only:

 

DIVIDE(
CALCULATE(SUM(raw[Value]),raw[Online/TE]="Online"),
CALCULATE(SUM(raw[Value]),raw[Online/TE]="TE")) 
 
A whole page date filter ruins other measures.  Thanks  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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