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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

PowerBI sum in a matrix

For example, let's say i have a table of daily sales 1Jan 2022 to 31 Dec 2024. and a separate table of daily sales for 2019. 1 jan 2022 to 31 Dec 2022 maps to 1 jan 2019 to 31 dec 2019 1jan 2023 to 31dec 2023 maps to 1 jan 2019 to 31 dec 2019 1 jan 2024 to 31 dec 2024 maps to 1 jan 2019 to 31 dec 2019 in powerBI, when i drag and drop in a matrix, with daily sales from 1jan 2022 to 31 dec 2024, and also for 2019 daily sales. the 2019 daily sales does not sum correctly. It will only be the total sum for 1 year?
e.g. currently my table is this.
Year 
2021
yeardaily sales2019 sales
20221210
20231310
20241410
total4910
 
 
I would like the total sum to be repeated for each day that is selected. So if i selected 1jan 2022 to 30june 2024, it should sum for 2.5years
so the total above should for example be 30. (the granularity is down to singular day. I have a solution which is to use SUMX for every date, but it is super slow, anyone knows an alternative?
2 REPLIES 2
Anonymous
Not applicable

hello,

 

the measure works and does seem like it could be faster. However, when I tried it , the measure is slower than simply using SUMX.

Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _table=
SUMMARIZE('Table','Table'[Date].[Year],"Value",[2019 sales])
return
IF(
   HASONEVALUE('Table'[Date].[Year]),[2019 sales],SUMX(_table,[2019 sales])
    )

2. Result:

 

vyangliumsft_0-1697784743757.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.