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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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