cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
noodles281 Frequent Visitor
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

Accepted Solutions
noodles281 Frequent Visitor
Frequent Visitor

Re: Fresh out of ideas after a measure stopped working

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

)

3 REPLIES 3
Highlighted
Community Support Team
Community Support Team

Re: Fresh out of ideas after a measure stopped working

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 other members find it more quickly.
noodles281 Frequent Visitor
Frequent Visitor

Re: Fresh out of ideas after a measure stopped working

Hello Frank,

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

noodles281 Frequent Visitor
Frequent Visitor

Re: Fresh out of ideas after a measure stopped working

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

)