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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Ritesh_Air
Post Patron
Post Patron

SumX with total

Hi,

 

I am trying to find customers who bought more than $500 worth of stuff. 

 

 

SumX for More than $500 with summarize = 
SUMX (
    'CPP POS',
    CALCULATE (
        SUM ( 'CPP POS'[Sales Amount] ),
        FILTER (
            SUMMARIZE ( 'CPP POS', RETAILER[Parent Retailer AB Number] ),
            SUM ( 'CPP POS'[Sales Amount] ) > 500
        )
    )
)

 

 

It works for individual row but gives me same result of total as if $500 filter is not applied. Below:

 

More than $500.PNG

 

Any help is appreciated. Thanks.

Ritesh

6 REPLIES 6
amitchandak
Super User
Super User

@Ritesh_Air , Try like

sales = sumx(filter(SUMMARIZE ( RETAILER, RETAILER[Parent Retailer AB Number] ,"_1" ,SUM ( 'CPP POS'[Sales Amount] ) ),[_1]>500),[_1])


Retailer count = countx(filter(SUMMARIZE ( RETAILER, RETAILER[Parent Retailer AB Number] ,"_1" ,SUM ( 'CPP POS'[Sales Amount] ) ),[_1]>500),[Parent Retailer AB Number])

@amitchandak @FarhanAhmed 

 

unfortunately no. Both of your formulas still gives me 1.04M. Adding a new picutre to give more context. 

The problem is: the number you are seeing on the screen : for e.g.:  $2196 could be made up of 2 transaction lines $1900 and $296,  and as shown above in one of the formulas, I do want to include everything at the grower level.

 

I tried to change my formula in summarize to Grower instead of Retailer as well but still getting the same answer. 

 

Amit Farhan.PNG

FarhanAhmed
Community Champion
Community Champion

Break your formula into two and see the results

SumX for More than $500 with summarize = 

    CALCULATE (
        SUM ( 'CPP POS'[Sales Amount] ),
        FILTER (
            SUMMARIZE ( 'CPP POS', RETAILER[Parent Retailer AB Number] ),
            SUM ( 'CPP POS'[Sales Amount] ) > 500
        )
    )

 

_SUMXformorethan500 = 
SUMX (
    'CPP POS',[SumX for More than $500 with summarize])

  







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




@FarhanAhmed 

 

Thanks. I tried that too but the problem is: if I have 2 line items for the same retailer

which constitutes $2196 (which is sum of $1879 + 317), it filters $317 row, which I want to include.

 

Hence I thought if I summarize it at the Retailer level then it will give me answer at that granularity.

 

So in below example, overall total should be little higher than $749K but less than $1.04M.

 

More than $500 SumX.PNG

Thanks,

Ritesh

 

Hi @Ritesh_Air 

 

"if I have 2 line items for the same retailer

which constitutes $2196 (which is sum of $1879 + 317), it filters $317 row, which I want to include."

 

Not quite understand, where does the $317 row? Do you like to include it or exclude it? could you plz provide the detailed data rather than fragment? that will be helpful for us to investigate it further. 

 

You can upload the dummy pbix to the onedrive for business and share the link here. please don't forget to disclose the expected results and remove the confidential info.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Try Change forumla a bit 

SumX for More than $500 with summarize = 

    CALCULATE (
       SUMX(Values( RETAILER[Parent Retailer AB Number] ),     SUM ( 'CPP POS'[Sales Amount] ) 
        )
    )


_SUM = CALCULATE( SUMX('CPP POS',[SumX for More than $500 with summarize]) , FILTER( 'CPP POS',[SumX for More than $500 with summarize]>500))






Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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