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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Show value as 0 before certain date otherwise show value based on filters applied

Hi Guys,

 

Seeking help solving a DAX problem.

I am trying to create a DAX measure which would set all values before current date to 0 otherwise show the expected value.

CPU forecast_WIP =

VAR currentdate = CALCULATE(MAX(Historical_allocation_total[DATE]),Historical_allocation_total[DATE] = TODAY())

RETURN VALUE(IF(ALLSELECTED(Historical_allocation_total[DATE]) < currentdate,0,
Historical_allocation_total[CPU_forecast] + calculate(Historical_allocation_total[CPU consumed up until forecast],ALL(Historical_allocation_total[DATE]))))

This does not work. I get an error = a table of multiple values was supplied where a single value was expected.

How should I structure this DAX logic to make sense?
Basically on this graph I want the yellow line to start where the pink one is ending. That part is okay, but the first part I dont want to be there.
marian_scipa_0-1668034596897.png

 


The other 2 measure defined in the previous one consist of CPU_forecast which is just a cumulative sum by date and this one to determine the sum today which I am then adding to the forecast, so the forecast starts at a value where todays data end.

CPU consumed up until forecast =
CALCULATE(
    SUM('Historical_allocation_total'[CPU consumed (GHz)]),
    ALL(Historical_allocation_total),FILTER(Historical_allocation_total,Historical_allocation_total[DATE] = TODAY()))

Any help please?

Thanks
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [CPU consumed up until forecast] and [CPU forecast_WIP] as below and check if you can get the expected result...

CPU consumed up until forecast =
VAR _seldate =
    SELECTEDVALUE ( Historical_allocation_total[DATE] )
RETURN
    CALCULATE (
        SUM ( 'Historical_allocation_total'[CPU consumed (GHz)] ),
        FILTER (
            ALLSELECTED ( Historical_allocation_total ),
            Historical_allocation_total[DATE] >= TODAY ()
                && Historical_allocation_total[DATE] <= _seldate
        )
    )
CPU forecast_WIP =
IF (
    SELECTEDVALUE ( Historical_allocation_total[DATE] ) < TODAY (),
    0,
    Historical_allocation_total[CPU_forecast] + Historical_allocation_total[CPU consumed up until forecast]
)

If the above one is not working, please provide some sample data in the table 'Historical_allocation_total' with Text format and the calculation logic [CPU forecast (GHz)], [CPU consume(GHz)] and [CPU consumed up until forecast] with the special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

Please update the formula of measure [CPU consumed up until forecast] and [CPU forecast_WIP] as below and check if you can get the expected result...

CPU consumed up until forecast =
VAR _seldate =
    SELECTEDVALUE ( Historical_allocation_total[DATE] )
RETURN
    CALCULATE (
        SUM ( 'Historical_allocation_total'[CPU consumed (GHz)] ),
        FILTER (
            ALLSELECTED ( Historical_allocation_total ),
            Historical_allocation_total[DATE] >= TODAY ()
                && Historical_allocation_total[DATE] <= _seldate
        )
    )
CPU forecast_WIP =
IF (
    SELECTEDVALUE ( Historical_allocation_total[DATE] ) < TODAY (),
    0,
    Historical_allocation_total[CPU_forecast] + Historical_allocation_total[CPU consumed up until forecast]
)

If the above one is not working, please provide some sample data in the table 'Historical_allocation_total' with Text format and the calculation logic [CPU forecast (GHz)], [CPU consume(GHz)] and [CPU consumed up until forecast] with the special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Anonymous
Not applicable

This is working exactly as I wanted! Thank you very much for such a swift help. Appreciate it 🙂

amitchandak
Super User
Super User

@Anonymous , Simply Try like

CALCULATE(MAX(Historical_allocation_total[DATE]),Historical_allocation_total[DATE] = TODAY()) +0

 

or

SUM('Historical_allocation_total'[CPU consumed (GHz)]) +0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.