March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I would like to create a chart where actuals are columns/months and target can be selected with slicer and it changes dynamically. Even more if possible, I would like to add the %diff on top of the columns vs the selected target. I did the chart against 1 target, but I can not develop it further with more targets. I show you 1 column example where target is the grey short line and the figures are calculated with dax.
Is it possible to have 3 different targets in 1 chart and after selecting one by slicer, the differences will appear? I dont want to have 3 targets on the chart at the same time.
Maybe my table does it a little bit harder, as I have 1 database where there is 1 column with the version, meaning actual, BP, PY, everything is in 1 column. See a dummy version:
Thank you in advance for the help!
Solved! Go to Solution.
Hello @Evelin_,
Can you please try the following:
Actual_vs_Target_Display =
VAR SelectedTarget = SELECTEDVALUE('Table'[Version]) -- Get the selected target from the slicer
VAR ActualSales =
CALCULATE(
SUM('Table'[Sales]),
'Table'[Version] = "ACT"
)
VAR TargetSales =
CALCULATE(
SUM('Table'[Sales]),
'Table'[Version] = SelectedTarget
)
VAR SalesDifference = ActualSales - TargetSales
VAR PercentDifference =
IF(
TargetSales <> 0,
DIVIDE(SalesDifference, TargetSales, 0),
BLANK()
)
RETURN
IF(
NOT(ISBLANK(ActualSales)),
ActualSales & " (Target: " & TargetSales & ", Diff: " & FORMAT(PercentDifference, "0.00%") & ")",
BLANK()
)
I did it, Thank you for your help! it was very useful to finish my chart 🙂
Hello Sahir,
Thank you for the dax, with your help I created this measure succesfully in my PowerBI. Only question left is how I add it on the chart and connect it with the slicer? So far I had the posting period in X axis, actual sales column y axis, and 1 target line on line y axis, and this is what I want to change based on slicer + the value label.
Thank you very much!
Hi @Evelin_ ,
Did Sahir_Maharaj reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.
Best regards,
Adamk Kong
Hello @Evelin_,
Can you please try the following:
Actual_vs_Target_Display =
VAR SelectedTarget = SELECTEDVALUE('Table'[Version]) -- Get the selected target from the slicer
VAR ActualSales =
CALCULATE(
SUM('Table'[Sales]),
'Table'[Version] = "ACT"
)
VAR TargetSales =
CALCULATE(
SUM('Table'[Sales]),
'Table'[Version] = SelectedTarget
)
VAR SalesDifference = ActualSales - TargetSales
VAR PercentDifference =
IF(
TargetSales <> 0,
DIVIDE(SalesDifference, TargetSales, 0),
BLANK()
)
RETURN
IF(
NOT(ISBLANK(ActualSales)),
ActualSales & " (Target: " & TargetSales & ", Diff: " & FORMAT(PercentDifference, "0.00%") & ")",
BLANK()
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
16 | |
16 | |
12 |