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 August 31st. Request your voucher.

Reply
JIN23
Helper I
Helper I

How to show value from Max week selected in the filter as total column?

Hi

 

I have calculated sell-through and when I select multiple weeks in the filter, I want to show only sell-through of max week selected as total not sum of everything to calculate..

 

How can I do it? 

JIN23_0-1722498365307.png

What I want is to bring 77.2% as total ST% instead of 5.6%..

 

Same for the stock gross, I want to bring 503,239,352 instead of sum of everything. 

 

I need help!

 

Thanks

 

1 ACCEPTED SOLUTION
aduguid
Super User
Super User

Try this measure. This assumes you have a calendar type table setup for the week numbers 

ST = 
VAR MaxWeek = MAX('YourWeekTable'[WeekColumn]) -- Adjust 'YourWeekTable' and 'WeekColumn' to your table and column names
VAR MaxSalesGrossAcc = 
    CALCULATE(
        SUM('YourTable'[SalesGrossAcc]), 
        'YourWeekTable'[WeekColumn] = MaxWeek
    )
VAR MaxStockGrossAcc = 
    CALCULATE(
        SUM('YourTable'[StockGrossAcc]), 
        'YourWeekTable'[WeekColumn] = MaxWeek
    )
VAR SalesGrossAcc = SUM('YourTable'[SalesGrossAcc])
VAR StockGrossAcc = SUM('YourTable'[StockGrossAcc]), 
VAR MaxSellThroughPercentage = DIVIDE(MaxSalesGrossAcc, MaxSalesGrossAcc + StockGrossAcc)
VAR SellThroughPercentage = DIVIDE(SalesGrossAcc, SalesGrossAcc + StockGrossAcc)

RETURN
    IF(
        HASONEVALUE('YourWeekTable'[WeekColumn]),
        SellThroughPercentage,
        MaxSellThroughPercentage
    )

 

View solution in original post

3 REPLIES 3
aduguid
Super User
Super User

Try this measure. This assumes you have a calendar type table setup for the week numbers 

ST = 
VAR MaxWeek = MAX('YourWeekTable'[WeekColumn]) -- Adjust 'YourWeekTable' and 'WeekColumn' to your table and column names
VAR MaxSalesGrossAcc = 
    CALCULATE(
        SUM('YourTable'[SalesGrossAcc]), 
        'YourWeekTable'[WeekColumn] = MaxWeek
    )
VAR MaxStockGrossAcc = 
    CALCULATE(
        SUM('YourTable'[StockGrossAcc]), 
        'YourWeekTable'[WeekColumn] = MaxWeek
    )
VAR SalesGrossAcc = SUM('YourTable'[SalesGrossAcc])
VAR StockGrossAcc = SUM('YourTable'[StockGrossAcc]), 
VAR MaxSellThroughPercentage = DIVIDE(MaxSalesGrossAcc, MaxSalesGrossAcc + StockGrossAcc)
VAR SellThroughPercentage = DIVIDE(SalesGrossAcc, SalesGrossAcc + StockGrossAcc)

RETURN
    IF(
        HASONEVALUE('YourWeekTable'[WeekColumn]),
        SellThroughPercentage,
        MaxSellThroughPercentage
    )

 

JIN23
Helper I
Helper I

st = sales gross acc / (sales gross acc+stock gross)

aduguid
Super User
Super User

Can you please post the text for the ST% measure?

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.