Forum Discussion
yak8q8
2 years agoNew Member
Need Help With Prior Year Measure in Power BI Direct Query
Hello all, Please help me figure out what's wrong. I have a visual that needs to show sum of decs by customer and it should show current year and prior year and I should be able to select any year A...
- 2 years ago
yak8q8 Sounds like you will need to add a filter for your customer then. Grab you customer using MAX or SELECTEDVALUE and then add it to your filter clause.
yak8q8
2 years agoNew Member
Hi Greg, thank you for your reply. Unfortunately the error I get is "there is not enough memory to complete this operation". Any other ideas?
- Greg_Deckler2 years agoCommunity Champion
yak8q8 Try this:
ENTRY VOLUME PY = VAR PRIORYEAR = SELECTEDVALUE('ft_DEC Dates'[Year]) - 1 VAR CURRMONTHS = DISTINCT('ft_DEC Dates'[Month]) VAR __TABLE = SUMMARIZE(FILTER(ALL('ft_DEC Dates'),[Year] = PRIORYEAR && [Month] IN CURRMONTHS),[Year], [Month], "__Value", SUM('ft_DEC Dates'[DEC SUM]) ) VAR __RETURN = SUMX( __TABLE, [__Value]) RETURN __RETURN