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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Table not return the correct total of a measure

i created a measure to count the total number of orders a customer did on the months, but i saw the total is wrong. I need help to correct this total  (1+1+1+1+1+2+2 =9)

 

Titulo1.png

 

This is my measure

 
.Measure1 =
IF (
MAX ( 'Calendario1'[Date] ) <= EOMONTH ( TODAY (); -13 );
BLANK ();
IF (ISBLANK ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) );0;DISTINCTCOUNT ( fOrder[K_NumberOrder] )))

 

Thanks

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I was close, but this will work:

.Measure1 = 
SUMX( VALUES ( Calendario1),
    CALCULATE(
        IF (
            MAX ( 'Calendario1'[Date] ) <= EOMONTH ( TODAY (), -13 ),
            BLANK (),
        IF (
                ISBLANK ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ),
                0,
                DISTINCTCOUNT ( fOrder[K_NumberOrder] )
            )
       )
    )
 )

sumx of values.png

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Without seeing the actual data, you need to add in SUMX( Values( Date[Month]) to your measure. Maybe something like this, but more of a guess:

.Measure1 =
IF (
    MAX ( 'Calendario1'[Date] )
        <= EOMONTH (
            TODAY ();
            -13
        );
    BLANK ();
    IF (
        ISBLANK (
            DISTINCTCOUNT ( fOrder[K_NumberOrder] )
        );
        0;
        SUMX ( VALUES ( Date[Month]);
        DISTINCTCOUNT ( fOrder[K_NumberOrder] )
        )
    )
)
Anonymous
Not applicable

Hey @Anonymous ,  here is my  data 

 

https://1drv.ms/u/s!Apt7lzq2XcE5jCXGwG2vlblnXDOX

 

Thanks

Anonymous
Not applicable

I was close, but this will work:

.Measure1 = 
SUMX( VALUES ( Calendario1),
    CALCULATE(
        IF (
            MAX ( 'Calendario1'[Date] ) <= EOMONTH ( TODAY (), -13 ),
            BLANK (),
        IF (
                ISBLANK ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ),
                0,
                DISTINCTCOUNT ( fOrder[K_NumberOrder] )
            )
       )
    )
 )

sumx of values.png

Anonymous
Not applicable

Worked, thanks a lot @Anonymous 

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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