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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PKPK90
Helper I
Helper I

Show one value from measure, filtered by different measure

Hi,
I'am working on ABC analysis, and I want to create/format Scatter chart based on measures. I want to add X-Axis line that will correspond to minimum value from SalesAmount where RunningSales% is less than 70%. Only one number.

In this case it should show ~18$.

 

PKPK90_2-1679570873190.png

 

I have a measure to get RunningSales%, and also I have a measure with SalesAmount per Item.

M_RunningSales% =
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
        CurrentCumulatedPct
)
M_Sales Amount = SUMX(CustomerOrders,CustomerOrders[QtyOrdered] * CustomerOrders[UnitPrice])
 
Any suggestions? Thank you in advance!

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @PKPK90 ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
MAXX(
    FILTER(ALLSELECTED('Table'),
    'Table'[RunningToal%]=
MAXX(
    FILTER(ALLSELECTED('Table'),'Table'[RunningToal%]<=0.7),[RunningToal%])),'Table'[TotalSales])

2. Result:

vyangliumsft_0-1679883745971.png

 

If I have misunderstood your meaning, Can you express the result in the form of a picture or please provide your pbix file without privacy information and desired output, we can help you better.

 

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

Yes, thank you, it is exactly what I was looking for but it is not working for some reason on my report. It is showing blanks. 
I think it can be because I have a measure for TotalSales (because there is more lines for one item, so I need to group/sum them before showing in the table) = 

M_Sales Amount = SUMX(CustomerOrders,CustomerOrders[QtyOrdered] * CustomerOrders[UnitPrice])

 

Second thing is, I have Item master table which is used to filter table. You can see it on my M_RunningSales% measure.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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