Forum Discussion
Phoenix538
6 years agoFrequent Visitor
Use selected filter for previous year
Good day all, I am pretty new to Power Bi, loveing the program but stumbling accross something that I cannot figure out. I sccuesfully managed to calculate the YTD turnover and compare it to the...
- 6 years ago
Hi Phoenix538 ,
You can try to create an unrelated calendar table to use as a slicer.
Running total:
Running total= CALCULATE ( SUM ( Sales[Sales] ), FILTER ( ALLSELECTED ( 'Sales' ), SELECTEDVALUE(DimDate[year])= YEAR(Sales[Date])&& Sales[Date]<=MAX(Sales[Date]) ) )Sum of last year:
sum_Sales_last_year = CALCULATE ( SUM( Sales[Sales] ), FILTER ( ALL ( Sales[Date] ), YEAR(Sales[Date]) = SELECTEDVALUE(DimDate[year])-1 ))Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
V-lianl-msft
6 years agoCommunity Support
Hi Phoenix538 ,
You can try to create an unrelated calendar table to use as a slicer.
Running total:
Running total=
CALCULATE (
SUM ( Sales[Sales] ),
FILTER (
ALLSELECTED ( 'Sales' ),
SELECTEDVALUE(DimDate[year])= YEAR(Sales[Date])&&
Sales[Date]<=MAX(Sales[Date])
)
)Sum of last year:
sum_Sales_last_year =
CALCULATE (
SUM( Sales[Sales] ),
FILTER (
ALL ( Sales[Date] ),
YEAR(Sales[Date]) = SELECTEDVALUE(DimDate[year])-1
))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.