Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Calculation based on slicer (slicer is calculable)

Hello,

 

i need some hints for my solution.

 

1. What i have (and what is workling) - data calculation and a lot of slicer for detail analysis.

One of the slicer is year and period (=months).

Calculation is based on measurements. In Measurement is based on calculate/sum over IDs.

 

2. What i´m looking for:

solution for calculation - "year / period" before the year in actual slicer.

Well, to calculate the right year or period bevore dependign on selected slicer ist a simply thing, but to calculate new measurements (now based on period, or better to say, selected period in slicer minus 1 year)... here is my problem.

i hope you have some ideas and hints for me.

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

For period we can use Week VS Week approch https://www.youtube.com/watch?v=pnAesWxYgJ8

amitchandak
Super User
Super User

@Anonymous , Not very clear but with help from a date table and time intelligence

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))


//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
rolling = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]>=max('Date'[Year])-2 && 'Date'[Year]<=max('Date'[Year])) )

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Anonymous
Not applicable

hope to make it clear... here is one measure:

CALCULATE(SUM(IS[balance]),IS[AggregationID]=1)

as You see, i dont have YAER or Period in my calculation, because in model the date is combined so i get the right information/calculation back in the matrix, cause i have the YEAR and Period slicer.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors