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.
Hello,
in my table, I have a column called "Scenario", which allows the User to select datas for Actual, Budget, LUF....
Now, in order to be able to create a stacked barchard, I will create a new Scenario, which is based on a Slicer the User can use: This Slicer is the Year and the new scenario should be called "Previous" and should filter then on Scenario "Actual" and Year = Selected Year - 1. (with that, the visual would work fine and I can show the Previous Year, planned periods (Budget, LUF) and Actual Year).
I currently have:
A second table which is not linked to the Mastertable with all the years which are available. (=YearDimension)
A measure called "SelYear" = Selectedvalue(YearDimension[Jahr])
A measure called "PrevYear" = RawData[SelYear] - 1
Both measures are part of the Mastertable and when I choose in the year slicer the year 2020, my PrevYear is 2019.
Now, I have build a new column in the mastertable called "Scen" with
Scen = If(And('Raw Data'[Scenario] = "Actual", 'Raw Data'[Jahr]=[PrevYear]),"Previous",'Raw Data'[Scenario])
But this is not giving me the new Scenario "Previous" for the 2019 Actual values.... How can I create such a new Scenario based on the Year Slicer?
Solved! Go to Solution.
Hi @Pfoerster ,
First create a year table as below:
Table 2 = VALUES('Table'[Year])
Then create a measure as below:
_Scen =
IF(MAX('Table'[Year])=SELECTEDVALUE('Table 2'[Year])-1&&MAX('Table'[Scenario])="Actual","Previous",MAX('Table'[Scenario]))
And you will see:
You can use the following measure to color the above value:
_color = IF('Table'[_Scen]="Previous","#f44242","#000000")
For the related .pbix file,pls see attached.
@Pfoerster , Not very clear .
Please check how measure slicer is done
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://www.youtube.com/watch?v=vlnx7QUVYME
for time intelligence
Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Power BI — QTD
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
Power BI — MTD
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
example
YTD = CALCULATE([Total],DATESYTD('Date'[Date],"12/31"))
Last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year = CALCULATE([Total],DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last to last YTD = CALCULATE([Total],DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
To make it clear:
Scenario | Year | Territory | Scen |
Actual | 2020 | East | Actual |
Budget | 2020 | East | Budget |
Actual | 2019 | East | Previous |
LUF | 2020 | East | LUF |
My table is looking like this, but: Currently, I am struggeling by getting the "Previous". This should occure, when the user is selecting 2020 in a Slicer in the report. So, the column "Scen" is based on the Slicer of the Report.
Hi @Pfoerster ,
First create a year table as below:
Table 2 = VALUES('Table'[Year])
Then create a measure as below:
_Scen =
IF(MAX('Table'[Year])=SELECTEDVALUE('Table 2'[Year])-1&&MAX('Table'[Scenario])="Actual","Previous",MAX('Table'[Scenario]))
And you will see:
You can use the following measure to color the above value:
_color = IF('Table'[_Scen]="Previous","#f44242","#000000")
For the related .pbix file,pls see attached.
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 | |
96 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |