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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PKPK90
Helper I
Helper I

Use measure in the row

I have created a measure that is grouping Items into ABC category, I also have a table that can show Item with new ABC Category, but next step is to show Total sales and count of items per ABC group in matrix table, how can resolve it?

 

Here is my measure 

M_ABC_SalesAmount =
IF (
    HASONEVALUE ( Items[Item] ),
    VAR SalesByProduct =
        CALCULATETABLE (
            ADDCOLUMNS (
                SUMMARIZE ( CustomerOrders, CustomerOrders[SiteItem] ),
                "@ProdSales", [M_Sales Amount]
            ),
            ALLSELECTED ( Items )
        )
    VAR AllSales =
        CALCULATE (
            [M_Sales Amount],
            ALLSELECTED ( Items)
        )
    VAR CurrentSalesAmt = [M_Sales Amount]
    VAR CumulatedSales =
        FILTER (
            SalesByProduct,
            [@ProdSales] >= CurrentSalesAmt
        )
    VAR CumulatedSalesAmount =
        SUMX (
            CumulatedSales,
            [@ProdSales]
        )
    VAR CurrentCumulatedPct =
        DIVIDE (
            CumulatedSalesAmount,
            AllSales
        )
    VAR Result =
        SWITCH (
            TRUE,
            ISBLANK ( CurrentCumulatedPct ), BLANK (),
            CurrentCumulatedPct <= 0.7, "A",
            CurrentCumulatedPct <= 0.9, "B",
            "C"
        )
    RETURN
        Result
)
 
What I want to show in the next step
Matrix:
ABC
70000$20000$10000$
25Items500Items1500items
1 REPLY 1
Anonymous
Not applicable

HI @PKPK90,

Current measure expression not able to be used as category or axis fields to expand the calculation ranges.
I'd like to suggest you create a new table with correspond segmentation and types to use on matrix column field. Then you can use measure formula to show different result based on current category values.

Regards,

Xiaoxin Sheng

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.