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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Ellis_Woods
Regular Visitor

SUMX card keeps returning 0

Hi all, i hope you're well!!

 

I am really struggling with why my SUMX function keeps returning zero. I am attempting to do a customer churn dashboard with revenue column (easy), last period sales: 

Last Period's Sales = CALCULATE(
    SUM(Table_Query_from_MMS[Revenue]),
    DATESINPERIOD(
        Table_Query_from_MMS[DocumentDate].[Date],
        LASTDATE(Table_Query_from_MMS[DocumentDate].[Date]),
        -12,
        MONTH)
)
, revenue 2022 (again straight forward), and then lost customers:
Lost Customers 2023 = if(AND([Last Period's Sales]=0,[Revenue 2022]>0),1,0).
 
From this i just want to find out the overall count of lost customers to put it as a card. When doing this, it just returns 0.
 
Ellis_Woods_0-1704893228713.png

 

When you scroll down on this, 1's appear for the customers that ordered in 2022 but not 2023. it should =85 but does not.

Id really appreciate some advice as im quite new and its really doing my head in!

 

5 REPLIES 5
ValtteriN
Super User
Super User

Hi,

could you provide the dax for the SUMX in your card measure:

Here is a working example based on a different condition as a reference:

Data:

ValtteriN_1-1704895650122.png

 



Dax:

test = IF(MIN('Table (19)'[Column1])=0,0,1)

Measure
11 = SUMX('Table (19)',[test])

ValtteriN_0-1704895516156.png

 







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

Proud to be a Super User!




This is the DAX for the card:
Lost customers 2023 count = SUMX(Table_Query_from_MMS,Table_Query_from_MMS[Lost Customers 2023])

Hi,

It is a bit tricky to confirm is guess is correct, but my assumption is the following:

I think the table visual has a different filter context than your fact table (Table_Query_from_MMS). Because of this when the [Lost Customers 2023] is evaluated over the table the rows are all 0.

Here is an example of this behaviour with my demo data:

ValtteriN_0-1704959702405.png

 

Here the table shows 2 rows with 1's. However the card shows 3. This is because when the table contains 3 rows with dim b:

ValtteriN_1-1704959779742.png

 

Now when the SUMX evaluates the table without filters -> as per the interaction in card the result is 3.

In your case when if(AND([Last Period's Sales]=0,[Revenue 2022]>0),1,0) is evaluated row by row over Table_Query_from_MM each row likely gets the value 0.







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

Proud to be a Super User!




Thank you so much for getting back to me! I'm really stumpped!

 

My Lost customer column is not just returning 0. All together out of this long list, 85 rows return the value of 1. The only issue is summing these up and displaying it on a card.

 

Ellis_Woods_0-1704960884933.png

 

Hi,

What I meant was that since SUMX will evaluate the formula over your table as seen in table view:

ValtteriN_0-1704963572181.png

And not as shown in your visual the result might be different eventhough your visual shows 1's.

Basically consider how the IF condition evaluates if it was a added as a calculated column.





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

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.