Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello Guys,
this is my chart:
and the measure is simple:
Cumulative Budget Variance =
VAR CurrentDate = MAX ( 'Dim_Date'[Date] )
RETURN
CALCULATE (
[Budget Variance],
FILTER (
ALL ( 'Dim_Date'[Date] ),
'Dim_Date'[Date] <= CurrentDate
)
)
Budget Variance = [Sum Budget Amount] - [Actual Cost Budget Daily]
So what i want is to have 0 in a first selected date in a bar chart.
How to do this in DAX?
Best,
Jacek
Solved! Go to Solution.
Hi @jaryszek,
Try the following code:
Cumulative Budget Variance =
VAR MinimumDate = MINX(ALLSELECTED('Dim_Date'[Date]), 'Dim_Date'[Date])
VAR CurrentDate = MAX ( 'Dim_Date'[Date] )
RETURN
IF( SELECTEDVALUE('Dim_Date') = MinimumDate, 0
CALCULATE (
[Budget Variance],
FILTER (
ALL ( 'Dim_Date'[Date] ),
'Dim_Date'[Date] <= CurrentDate
)
)
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @jaryszek ,
Apologies for the question but what do you mean 0 on the first selected date in the bar chart?
The bart chart that you present I assume has the days on the axis, do you have any selection of dates to get this visualization?
Can you please elaborate a litle bit more on the context.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Portuguêsthanks!
by 0 i want to have just empty there. It means that first day of selected dates within slicer should be empty always.
I do not want to have budget variance there.
Best,
Jacek
Hi @jaryszek,
Try the following code:
Cumulative Budget Variance =
VAR MinimumDate = MINX(ALLSELECTED('Dim_Date'[Date]), 'Dim_Date'[Date])
VAR CurrentDate = MAX ( 'Dim_Date'[Date] )
RETURN
IF( SELECTEDVALUE('Dim_Date') = MinimumDate, 0
CALCULATE (
[Budget Variance],
FILTER (
ALL ( 'Dim_Date'[Date] ),
'Dim_Date'[Date] <= CurrentDate
)
)
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsOk didnt work but you pointed me to right direction:
New_Cumulative Budget Variance 2 =
VAR MinimumDate =
CALCULATE (
MIN ( 'Dim_Date'[Date] ),
ALLSELECTED ( 'Dim_Date'[Date] )
)
VAR CurrentDate =
MAX ( 'Dim_Date'[Date] )
RETURN
IF (
SELECTEDVALUE ( 'Dim_Date'[Date] ) = MinimumDate,
0,
CALCULATE (
[Budget Variance],
FILTER (
ALLSELECTED ( 'Dim_Date'[Date] ),
'Dim_Date'[Date] <= CurrentDate
)
)
)
Minx was not working because it took dates from entire Dim_Date table, not selected month.
Thanks
Jacek
Hi @jaryszek ,
It should give you the correct result but this can also depend on how you have your model working and the interactions between visuals and relationships.
Glad it pointed you to the correct option.
Don't forget to mark the correct answer so it can help others even if it is your own answer.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsIf you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 14 | |
| 10 | |
| 6 | |
| 5 |