Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi Guys
I'm still new with Power BI Desktop and I have one senario where I have current and previous years which user should select. and based on that the calculation should be substraction of values.
example:
| Value | DATE |
| 200 | 28-Dec-22 |
| 345 | 05-Dec-23 |
| 500 | 29-Dec-18 |
| 980 | 13-Dec-19 |
| 441 | 22-Dec-20 |
If user select previous year as (28-Dec-22) and current year (05-Dec-23) the calculation will be (value=345-200)
could any one please help!
Can anyone please help!
Hello @AsNa_92,
Can you please try the following steps:
1. First, ensure you have a Date table that covers the range of dates in your data. Next, create Slicers for Year Selection.
Year = YEAR(Date[Date])
2. Create Measures for Selected Years
Previous Year Value =
VAR SelectedPreviousYear = SELECTEDVALUE(Date[Year])
RETURN
CALCULATE(SUM(Table[Value]), FILTER(ALL(Table), YEAR(Table[DATE]) = SelectedPreviousYear))
Current Year Value =
VAR SelectedCurrentYear = SELECTEDVALUE(Date[Year], MAX(Date[Year]))
RETURN
CALCULATE(SUM(Table[Value]), FILTER(ALL(Table), YEAR(Table[DATE]) = SelectedCurrentYear))
3. Create a Measure for Subtraction
Value Difference =
[Current Year Value] - [Previous Year Value]
Hi Sahir_Maharaj,
Thank for replying, I didn't get the Year=YEAR(Date[Date])? So, Icannot use the Date column I already have? or do I create a new column for Year? and when I try to create the Year measure it shows error like what is exactly the (Date[Date])?
Also, the current and previous years measure cannot be inserted into a slicer. The logic is the user will select from a slicers a current year and Previous year same as below:
The YTD movment will have the calculation:
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 51 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 38 | |
| 29 | |
| 27 |