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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.