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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Maxemus2000
Helper II
Helper II

Is it possibly to display item total by using sumx in clustered chart

Hi All,

I would like to display a sum of each calculated item from all of the stores in a clustered bar chart. Is it possible?

 

I have created a measure call "Impact" to calculate each item impact from each store. When I put Impact measure in a matrix table with store and item, it displays each item impact corretly. Below is a code from Impact measure. 

Impact = 
VAR StoreVol_2020 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2020,
                            'ID'[ID] = 1)
VAR StoreVol_2019 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2019,
                            'ID'[ID] = 1)
VAR AllStoreVol_2020 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2020,
                            'ID'[ID] = 1,
                            ALLSELECTED(Sales[Item]))
VAR AllStoreVol_2019 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2019,
                            'ID'[ID] = 1,
                            ALLSELECTED(Sales[Item]))
VAR StoreCost_2020 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2020,
                            'ID'[ID] = 2)
VAR StoreCost_2019 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2019,
                            'ID'[ID] = 2)
VAR AllStoreCost_2020 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2020,
                            'ID'[ID] = 2,
                            ALLSELECTED(Sales[Item]))
VAR AllStoreCost_2019 = CALCULATE(SUM(Sales[Amount]),
                            'Calendar'[Year] = 2019,
                            'ID'[ID] = 2,
                            ALLSELECTED(Sales[Item]))
VAR AvgCost_2020 = DIVIDE(StoreCost_2020, StoreVol_2020)
VAR AvgCost_2019 = DIVIDE(StoreCost_2019, StoreVol_2019)
VAR AllStoreAvgCost_2020 = DIVIDE(AllStoreCost_2020, AllStoreVol_2020)
VAR AllStoreAvgCost_2019 = DIVIDE(AllStoreCost_2019, AllStoreVol_2019)
VAR StoreVolPct_2020 = DIVIDE(StoreVol_2020, AllStoreVol_2020)
VAR StoreVolPct_2019 = DIVIDE(StoreVol_2019, AllStoreVol_2019)
VAR PctDiff = StoreVolPct_2020 - StoreVolPct_2019
VAR VolImpact = PctDiff * AllStoreVol_2020
VAR CostImpact = AvgCost_2019 - AllStoreAvgCost_2019
VAR Impact = VolImpact * CostImpact
Return
Impact

 

Data in Sales table

image.png

 

Here is relationship between each table. 

image.png

 

Here is a matrix table showing calculated impact from each item in each store. When I put item in a clustered bar with Impact measure, it shows nothing.

Maxemus2000_0-1598399182843.png

My end goal is to get a clusterd bar chart that display a sum Impact measure by each item. 

Maxemus2000_1-1598399194957.png

 

Appreicate all of you guys help!

 

 

 

1 ACCEPTED SOLUTION

Hi @Maxemus2020 , @Maxemus2000 ,

 

Please try this:

 

Measure = SUMX(VALUES('Store'[Store]),[Impact])

 1.PNG

 

 

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

View solution in original post

8 REPLIES 8
lbendlin
Super User
Super User

Show the formula for SUMX_Total.

@lbendlin Thanks for taking a look at this! 

Here is a formula for SUMX_Total

SUMX_Total = sumx(VALUES(Sales[Store]),sumx(VALUES(Sales[Item]),[Impact]))

 

Also, i think x, y, and z might re-do their "Impact" measure calculations in the clustered chart since we don't have store in there. If that's true, I need to find to way to get the result as i stated in my end goal. 

 

 

Hi @Maxemus2000 ,

 

Have you resolved it? If not, can you please share a dummy file with us? You could upload it into Onedrive for business. Then we will understand clearly. Thanks!

 

 

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

@v-xuding-msft 

Due to IT security, I don't think you will be able to access our sharedrive even though i provide the link to the model. 

 

My dummy model is the exactly what i posted in my original question. I only have 2 measures; Impact and SUMX_Total. Both of their code are posted. 

Sales table is a fact table. 


Relationship:
ID table to Sales, 1 to many via ID
Item table to Sales, 1 to many via Item
Calendar table to Sales, 1 to many via Year 
Store table to Sales, 1 to many via Store

@v-xuding-msft 

 

Here is a link to my sample file

 

Sample File 

Hi @Maxemus2020 , @Maxemus2000 ,

 

Please try this:

 

Measure = SUMX(VALUES('Store'[Store]),[Impact])

 1.PNG

 

 

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

@v-xuding-msft 

 

It works! Thanks for your help. I guess my previous SUMX was incorrect. 

SUMX_Total = sumx(VALUES(Sales[Store]),sumx(VALUES(Sales[Item]),[Impact]))

 

I'm still new to this, can you explain what went wrong with my SUMX above and why it didn;t give me the result I wanted? 

For debugging use lots of intermediate variables and CONCATENATEX for the debug output.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors