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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
King8James
Regular Visitor

Dynamic sales based on slicer

Hello,

 

I need to create a measure that gives the sales of the selected scenario (selected by users from slicer) then adds previous sales (called "fix"), for example if scenario starts from may,then "fix" should end at april and so on, i created the following measure 

new sales= 

VAR sce = SELECTEDVALUE(forecast[Alternative])


return



CALCULATE(SUM(data[Sales]),FILTER(data, data[Alternative]=sce || data[Alternative]="FIX" 

))

 

 but it gives me overlp like this 

 

King8James_0-1660744807007.png

what i want is this

 

King8James_1-1660744826433.png

 

can someone help me with that please

here is the data

 

King8James_2-1660744847101.png

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @King8James ,

 

Please try:

new sales =
VAR sce =
    SELECTEDVALUE ( forecast[Alternative] )
VAR _a =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Alternative] = sce || 'Table'[Alternative] = "FIX" )
    )
VAR _d =
    CALCULATE (
        MIN ( 'Table'[Month] ),
        FILTER ( ALL ( 'Table' ), [Alternative] = sce )
    )
RETURN
    IF (
        MONTH ( MAX ( 'Table'[Month] ) ) >= MONTH ( _d )
            && MAX ( 'Table'[Alternative] ) = "FIX",
        BLANK (),
        _a
    )

Final output:

vjianbolimsft_1-1661222163924.png

 

vjianbolimsft_0-1661222149508.png

 

Best Regards,

Jianbo Li

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

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @King8James ,

 

Please try:

new sales =
VAR sce =
    SELECTEDVALUE ( forecast[Alternative] )
VAR _a =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Alternative] = sce || 'Table'[Alternative] = "FIX" )
    )
VAR _d =
    CALCULATE (
        MIN ( 'Table'[Month] ),
        FILTER ( ALL ( 'Table' ), [Alternative] = sce )
    )
RETURN
    IF (
        MONTH ( MAX ( 'Table'[Month] ) ) >= MONTH ( _d )
            && MAX ( 'Table'[Alternative] ) = "FIX",
        BLANK (),
        _a
    )

Final output:

vjianbolimsft_1-1661222163924.png

 

vjianbolimsft_0-1661222149508.png

 

Best Regards,

Jianbo Li

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

Thanks it works !!!

Arul
Super User
Super User

@King8James ,

Please provide the data in a accessible format so that it would be helpful for us to solve.

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


MonthAlternativeSales
01/06/2022VAR 2100
01/07/2022VAR 2100
01/08/2022VAR 2100
01/09/2022VAR 2100
01/10/2022VAR 2100
01/11/2022VAR 2100
01/12/2022VAR 2100
01/01/2023VAR 2100
01/02/2022FIX100
01/03/2022FIX100
01/04/2022FIX100
01/05/2022FIX100
01/06/2022FIX100
01/07/2022FIX100
01/05/2022VAR 1100
01/06/2022VAR 1100
01/07/2022VAR 1100
01/08/2022VAR 1100
01/09/2022VAR 1100
01/10/2022VAR 1100
01/11/2022VAR 1100
01/12/2022VAR 1100
01/01/2023VAR 1100

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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