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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

SUMX totals

Hello everyone, 

 

This may have been asked numerous times before, but I still struggled get to the correct total with SUMX despite going through the many examples posted here. 

 

I have a measure "Debit LY" which calls the last-year-same-weekday number for stores. However, the total (548,545) is not adding up as what would have been expected like the table on the right (911,377). Below is the measure that I wrote, any help is greatly appreciated !

 

Link to the file 

 

ringxiii_0-1624325924778.png

 

Debit LY = 
IF (
    COUNTROWS( 'Date' ) = 1,
    CALCULATE (
        SUM ( Debit[Debit] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Full Date] = SELECTEDVALUE ( 'Date'[LY Day2Day] ) )
    ),
    SUMX (
        SUMMARIZE (
            ALL ( Debit ),
            'Date'[Full Date],
            Store[Store],
            Debit[Debit]
        ),
        CALCULATE (
            SUM ( Debit[Debit] ),
            FILTER (  ALL ( 'Date' ) , 'Date'[Full Date] = 'Date'[LY Day2Day] ),
            ALL ( Store[Store] )
        )
    )
)

 

 

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this measure that uses the one you have:

Debit LY TOT =
SUMX (
    CROSSJOIN ( DISTINCT ( 'Date'[Full Date] ), DISTINCT ( Store[Store Code] ) ),
    [Debit LY]
)

Probably you can modify the original one as well. I haven't looked into it

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

ERD
Community Champion
Community Champion

Hello @Anonymous ,

If I've understood you correctly, here is your measure:

DebitLY =
CALCULATE (
    SUM ( Debit[Debit] ),
    SAMEPERIODLASTYEAR ( DATEADD ( 'Date'[Full Date], 1, DAY ) )
)

ERD_0-1624380156092.png

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

amitchandak
Super User
Super User

@Anonymous , Yet to check the file.

 

Try like

 

Debit LY = 
SUMX (
        ADDCOLUMNS(SUMMARIZE (
            ALL ( Debit ),
            'Date'[Full Date],
            Store[Store],
            Debit[Debit]),
        "_1", 

IF (
    COUNTROWS( 'Date' ) = 1,
    CALCULATE (
        SUM ( Debit[Debit] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Full Date] = SELECTEDVALUE ( 'Date'[LY Day2Day] ) )
    ),
    
        CALCULATE (
            SUM ( Debit[Debit] ),
            FILTER (  ALL ( 'Date' ) , 'Date'[Full Date] = 'Date'[LY Day2Day] ),
            ALL ( Store[Store] )
        )
    )
) ,[_1])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak, but the above still returns the same result. 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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