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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
stefani_vileva
Resolver II
Resolver II

Calculating total sum after filtering dates

Hello,

 

I have problem while calculating the sum of the rows in a matrix, while playing with the date. To be precise, I have one table which has orders for all customers at the specific time, the table looks like this:

CustomerOrder dateProductPrice
Cust A11.01.2021X10
Cust B10.01.2021Y2
Cust A13.05.2021Z5

 

I have a specific filter that filters only the order date. The solution of my problem would be a following matrix:

CustomerTotal Revenue
Customer A15
Customer B

2

 

I have tried using the following DAX, but every time, the total revenue changes after I play with the filter. 

REVENUE = CALCULATE(
SUM(ORDERS[PRICE]),
ALL(ORDERS[DATE])
)

I have also tried with this DAX expression, but then I got the total sum in every row, which is still not the right thing, as showed below: 
REVENUE = CALCULATE(
SUM(ORDERS[PRICE]),
ALL(ORDERS)
)

CustomerTotal Revenue
Customer A17
Customer B

17

 

Is there a possible way to calculate the total sum of each customer without being influenced of the date value?

Thank you very much.

 

1 ACCEPTED SOLUTION
stefani_vileva
Resolver II
Resolver II

I have solved my problem, the right DAX expression was 

 

REVENUE = CALCULATE(
SUM(ORDERS[PRICE]),
ALL(ORDERS)
)

 

The problem was, that I had a filter on the price of the page and it was messing my measure. But after I removed it, everything worked like a charm. 

View solution in original post

5 REPLIES 5
stefani_vileva
Resolver II
Resolver II

I have solved my problem, the right DAX expression was 

 

REVENUE = CALCULATE(
SUM(ORDERS[PRICE]),
ALL(ORDERS)
)

 

The problem was, that I had a filter on the price of the page and it was messing my measure. But after I removed it, everything worked like a charm. 

stefani_vileva
Resolver II
Resolver II

Hello @amitchandak ,

 

I don't know why, but when I use the first DAX, then the calculation is influenced by the filter (which should not be the case) and when I use the second DAX I don't get the right values in the grand total. 

Thank you for the fast response 🙂 

@stefani_vileva , this one ?

CALCULATE(
SUM(ORDERS[PRICE]),
filter(all(Order), Order[Customer] = max(Order[Customer] )
)

)

Then try

 

sumx(values(Order[Customer] )  ,

CALCULATE(
SUM(ORDERS[PRICE]),
filter(all(Order), Order[Customer] = max(Order[Customer] )
)

) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

If I use the SUMX, doesn't mean that the revenue would be doubled when summarized?

amitchandak
Super User
Super User

@stefani_vileva , what you want in table 2 is

SUM(ORDERS[PRICE])

 

if you want to ignore date filter

 

CALCULATE(
SUM(ORDERS[PRICE]),
removefilters(ORDERS[DATE])
)

 

 

or

 

 

CALCULATE(
SUM(ORDERS[PRICE]),
filter(all(Order), Order[Customer] = max(Order[Customer] )
)

)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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