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.
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 )
)
)
Solved! Go to Solution.
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)
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
)
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)
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
)
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
Hello Frank,
Thanks for getting back to me, I'm afraid I cannot share the file.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |