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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mikayla
Frequent Visitor

Dynamic Pre/Post Calculation

I'm trying to dynamically calculate for pre/post sales based on an index slicer selection. My dataset looks as follows:

 

IndexTimingTY SalesLY Sales
-4Pre473891263538
-3Pre543166385628
-2Pre764374329274
-1Pre876485183658
0Post563836954786
1Post292737283464
2Post484640234874

 

The formula would be (Post TY Sales - Pre TY Sales) / Pre TY Sales

The result would change based on your slicer selection ex: -3 to 2 or -1 to 1, etc. Thanks in advance!

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

Hi @mikayla ,


You could create a measure by the following formula:

value =
VAR _presum =
    SUMX ( FILTER ( 'Table', [Timing] = "Pre" ), [TY Sales] )
RETURN
    DIVIDE (
        SUMX ( FILTER ( 'Table', [Timing] = "Post" ), [TY Sales] ) - _presum,
        _presum
    )

The final output is shown below: When the choice of slicer is different(Use Ctrl to select multiple options), the value is also different

v-yalanwu-msft_2-1619071216475.pngv-yalanwu-msft_4-1619071227685.png

 

 


Best Regards,
Yalan Wu
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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi @mikayla ,


You could create a measure by the following formula:

value =
VAR _presum =
    SUMX ( FILTER ( 'Table', [Timing] = "Pre" ), [TY Sales] )
RETURN
    DIVIDE (
        SUMX ( FILTER ( 'Table', [Timing] = "Post" ), [TY Sales] ) - _presum,
        _presum
    )

The final output is shown below: When the choice of slicer is different(Use Ctrl to select multiple options), the value is also different

v-yalanwu-msft_2-1619071216475.pngv-yalanwu-msft_4-1619071227685.png

 

 


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

MURTAZA
Resolver I
Resolver I

@mikaylaYour problem is not clear. Can you elaborate?

Do you want help in writing this measure/calculated column or creating a slicer with ranges?

Of course, let me elaborate. I've already created the slicer with the index range but I am struggling with writing the measure/calculated column as I am fairly new to DAX. Any help is so appreciated! Let me know if I am still not being clear.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors