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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
BuistJF
Helper I
Helper I

MdxScript(Model) (29, 5) Calculation error in measure, though was previosuly working

I have the following DAX that aims to bring back the date where the highest running total was achieved. i.e. the date 09/09/22 would show because it had the highest running total, say 1000. Every day since then the running total has reduced but the above date would remain because it has the highest running total.

 

Today the running total has now exceded 1000 (1012) and I was expeting to get the latest date i.e. 17/02/2023 but I get an error. I have no filters applied on the page what am I missing? See DAX and error message below: 

Max Date of Running =
Var __SelectedMax =
 CALCULATE(
   MAX( DSET_DAILY_METRICS[Running Total]),
    ALLSELECTED(DSET_DAILY_METRICS)
)
RETURN
CALCULATE(
    VALUES(DSET_DAILY_METRICS[Date]),
        FILTER(
            ALL(DSET_DAILY_METRICS[Date]),
            MAX( DSET_DAILY_METRICS[Running Total]) = __SelectedMax )
)
 
Error Message:
MdxScript(Model) (29, 5) Calculation error in measure 'DSET_DAILY_METRICS'[Max Date of Running]: A table of multiple values was supplied where a single value was expected.
2 REPLIES 2
johnt75
Super User
Super User

It looks like more than one date has the same max value. Try changing VALUES to MAX.

Legend, thank you!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.