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
noodles281
Frequent Visitor

Fresh out of ideas after a measure stopped working

I have a table that records daily transactions so we like to see how many there are each day. We had a simple line chart comparing daily transatctions against the last three years so for example you could see 01-Aug-2016 compared to 01-Aug-2017 and 01-Aug-2018, the chart would show the full calendar month (more for simplicity than for any specific reason in theory last 30 -35 days would be more appropriate)

 

I have not been able to get SAMEPERIODLASTYEAR to work or PARALLELPERIOD or DATEADD, it's got to the point where I'm convinced it's a simple mistake I'm making but I'm fresh out of ideas.

 

WIP Y-1 =
CALCULATE (
    COUNTROWS ( fWIP ),
    FILTER (
        fWIP,
        fWIP[InApproval] = FALSE ()
            && fWIP[capcreated] = FALSE ()
            && fWIP[isBUS] = FALSE ()
            && fWIP[isLeaver] = FALSE ()
    ),
    USERELATIONSHIP( dDates[Date] , fWIP[stamp] ),
    SAMEPERIODLASTYEAR( dDates[Date] )

)

 

In the past I did get it to work using some horrific DAX, but that has stopped working

 

WIP Y-1 Test2 =
CALCULATE (
    COUNTROWS ( fWIP ),
    FILTER (
        fWIP,
        fWIP[InApproval] = FALSE ()
            && fWIP[capcreated] = FALSE ()
            && fWIP[isBUS] = FALSE ()
            && fWIP[isLeaver] = FALSE ()
    ),
    ALL ( dDates ),
    DATESBETWEEN (
        dDates[Date],
        CALCULATE ( MIN ( DDates[Date] ), dDates[monthdrift] = -12 ),
        CALCULATE ( MAX ( DDates[Date] ), DDates[monthdrift] = -12 )
    )
)

1 ACCEPTED SOLUTION
noodles281
Frequent Visitor

I managed to solve this just now. I went back to basics and fixed it, but I don't understand why it works as the visual filters should have stopped this from working, I was expecting to have to set a current month version of the measure up to be able to remove the current month filter from the visual (dDates[Monthdrift] = 0)

 

Measure.png

 

The measures  that worked are

 

This Year =
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),
)

 

 

Last Year = 
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),

ddates[Monthdrift] = -12

)

 

2 years ago = 
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),

dDates[Monthdrift] = -24

)

View solution in original post

3 REPLIES 3
noodles281
Frequent Visitor

I managed to solve this just now. I went back to basics and fixed it, but I don't understand why it works as the visual filters should have stopped this from working, I was expecting to have to set a current month version of the measure up to be able to remove the current month filter from the visual (dDates[Monthdrift] = 0)

 

Measure.png

 

The measures  that worked are

 

This Year =
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),
)

 

 

Last Year = 
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),

ddates[Monthdrift] = -12

)

 

2 years ago = 
CALCULATE(
COUNTROWS ( fWIP ),
FILTER (
fWIP,
fWIP[InApproval] = FALSE ()
&& fWIP[capcreated] = FALSE ()
&& fWIP[isBUS] = FALSE ()
&& fWIP[isLeaver] = FALSE ()
),

dDates[Monthdrift] = -24

)

v-frfei-msft
Community Support
Community Support

Hi @noodles281,

 

I tried to made a sample based on your description, but failed, Could you please share your pbix to me so that I can help with it?

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hello Frank,

Thanks for getting back to me, I'm afraid I cannot share the file.

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.