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

We'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

Reply
jaryszek
Resident Rockstar
Resident Rockstar

Cumulative Budget Variance with 0 on first selected Date

Hello Guys,

this is my chart:

jaryszek_0-1766485730833.png


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

 

1 ACCEPTED 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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

5 REPLIES 5
MFelix
Super User
Super User

Hi @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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





thanks! 

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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Ok 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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.