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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
summer18
Helper III
Helper III

Display the sum of a category

I need help on the formula on how can I display the correct values per category. 

 

Scenario:  I have an existing table chart in PowerBI and the picture below displays some of the columns (except Product Volume) in the table chart.  I want to create "Product Volume" measure = sum of "Product SKU Volume" per "Product".  It will display the Product Volume data on the min Product SKU only, the others will be blank/null so it will not display as repetitive values.  The desired output is shown on the pic below.

 

sample101.jpg

 

Hoping someone can help me on this because I've been working on this specific formula for a week already and could not make it to work.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1707712067887.png

 

Jihwan_Kim_1-1707712378576.png

 

 

 

Product SKU volume measure: = 
SUM( fact_volume[Product SKU Volumn] )

 

INDEX function (DAX) - DAX | Microsoft Learn

 

expected result measure: = 
VAR _result =
    CALCULATE (
        [Product SKU volume measure:],
        ALLEXCEPT ( dim_product, dim_product[Product] )
    )
VAR _condition =
    MAX ( dim_product[Product SKU] )
        = MAXX (
            INDEX (
                1,
                ALL ( dim_product ),
                ORDERBY ( dim_product[Product SKU], ASC ),
                ,
                PARTITIONBY ( dim_product[Product] )
            ),
            dim_product[Product SKU]
        )
RETURN
    _result * DIVIDE ( _condition, _condition )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1707712067887.png

 

Jihwan_Kim_1-1707712378576.png

 

 

 

Product SKU volume measure: = 
SUM( fact_volume[Product SKU Volumn] )

 

INDEX function (DAX) - DAX | Microsoft Learn

 

expected result measure: = 
VAR _result =
    CALCULATE (
        [Product SKU volume measure:],
        ALLEXCEPT ( dim_product, dim_product[Product] )
    )
VAR _condition =
    MAX ( dim_product[Product SKU] )
        = MAXX (
            INDEX (
                1,
                ALL ( dim_product ),
                ORDERBY ( dim_product[Product SKU], ASC ),
                ,
                PARTITIONBY ( dim_product[Product] )
            ),
            dim_product[Product SKU]
        )
RETURN
    _result * DIVIDE ( _condition, _condition )

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

It works!  Thank you very much @Jihwan_Kim  for the solution and the pbix  😊

danextian
Super User
Super User

Hi @summer18 ,

 

Can you please post your data as a workable table, not an image? You may post a link to an Excel file online.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Please try either:

Calc Column =
VAR __MIN_SKU =
    CALCULATE ( MIN ( data[SKU] ), ALLEXCEPT ( data, data[Product] ) )
VAR __TOTAL_BY_PRODUCT =
    CALCULATE ( SUM ( data[Volume] ), ALLEXCEPT ( data, data[Product] ) )
RETURNjUST
    IF ( data[SKU] = __MIN_SKU, __TOTAL_BY_PRODUCT )
Measure =
VAR __MIN_SKU =
    CALCULATE ( MIN ( data[SKU] ), ALLEXCEPT ( data, data[Product] ) )
VAR __TOTAL_BY_PRODUCT =
    CALCULATE ( SUM ( data[Volume] ), ALLEXCEPT ( data, data[Product] ) )
RETURN
    IF ( SELECTEDVALUE ( data[SKU] ) = __MIN_SKU, __TOTAL_BY_PRODUCT 




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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