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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
WaelTalaat79
Helper I
Helper I

Calculate value in coulamn based on Max week Number

Dears

thanks for your support in advance

i have this DAX fromula to calculate the stock value in coulmn based on another coulmn slicer range week number
Ex. the slicer from Week 10 to week 17

i need to sum the week 17 stock value to compare with the week 10 stock value

Stock Value Max =
VAR week_Max = MAX('EOL Follow up'[Week #])
return
CALCULATE(SUM('EOL Follow up'[TOTAL CP VALUE]),SELECTEDVALUE('EOL Follow up'[Week #])=week_Max)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @WaelTalaat79 

 

Thanks for the reply from @Ritaf1983 .

 

@WaelTalaat79 , you can try the following method as follows.

 

My sample:

vxuxinyimsft_0-1721807854745.png

 

1. Create a calculated table as the slicer

Slicer = VALUES('Table'[weeknum])

 

vxuxinyimsft_1-1721807941668.png

 

2. Create a measure as follows

Measure = 
VAR _max = CALCULATE(SUM('Table'[Value]), FILTER('Table', [weeknum] = MAX('Slicer'[weeknum])))
VAR _min = CALCULATE(SUM('Table'[Value]), FILTER('Table', [weeknum] = MIN('Slicer'[weeknum])))
RETURN
_max - _min

 

Output:

vxuxinyimsft_2-1721808071209.png

 

Best Regards,
Yulia Xu

 

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
WaelTalaat79
Helper I
Helper I

@Ritaf1983 i can't to upload the pbix but here below screen shot

the total stock value in week 13 and here if i select from 10 to 13 the idea is to show the value of the Max week numbwer which is 13  to compare with ninmum week numbwer which is 101pic.JPG

 

2pic.JPG

Anonymous
Not applicable

Hi @WaelTalaat79 

 

Thanks for the reply from @Ritaf1983 .

 

@WaelTalaat79 , you can try the following method as follows.

 

My sample:

vxuxinyimsft_0-1721807854745.png

 

1. Create a calculated table as the slicer

Slicer = VALUES('Table'[weeknum])

 

vxuxinyimsft_1-1721807941668.png

 

2. Create a measure as follows

Measure = 
VAR _max = CALCULATE(SUM('Table'[Value]), FILTER('Table', [weeknum] = MAX('Slicer'[weeknum])))
VAR _min = CALCULATE(SUM('Table'[Value]), FILTER('Table', [weeknum] = MIN('Slicer'[weeknum])))
RETURN
_max - _min

 

Output:

vxuxinyimsft_2-1721808071209.png

 

Best Regards,
Yulia Xu

 

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

Ritaf1983
Super User
Super User

Hi @WaelTalaat79 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors