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
vbharakhada
Frequent Visitor

Need a measure to find out the values in previous max dates upon selection of date in slicer.

Hi,
I need help with a measure.
When I select a date in the date slicer, Measure should check the max date among all the previous dates & match the item_name, and give me the value of that row.

Example: I have selected 05-Sep-2023, then it will search for the max date till 31-Aug-2023, i.e. It will give the data in that max row.
in data, the max date that is available before September 2023 is 29-07-2023, so it should give the data present in the 29-07-2023 row. (Already tried with PREVIOUSMONTH function not working) 

Below is the link to download the file 
Testing123.pbix
DG_UAE_11_09 - Copy.xlsx

Regards,

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

Hi @vbharakhada 

The file you provided cannot open.

The following solution is based on the sample data you have provided.

1.You can create a calendar table first

Table 2 = CALENDAR(DATE(2023,5,1),DATE(2023,10,1))

 2.Then create a measure

Measure = var a=MAXX(FILTER(ALLSELECTED('Table'),[Date_of_actual]<MAX('Table 2'[Date])),[Date_of_actual])
return CALCULATE(SUM('Table'[Cumulative_Actual]),FILTER('Table',[Date_of_actual]=a))

3.Put the date of table2 to the slicer.

Note:there is no relationship between two tables.

Output

vxinruzhumsft_0-1694744647579.png

Best Regards!

Yolo Zhu

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

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @vbharakhada 

The file you provided cannot open.

The following solution is based on the sample data you have provided.

1.You can create a calendar table first

Table 2 = CALENDAR(DATE(2023,5,1),DATE(2023,10,1))

 2.Then create a measure

Measure = var a=MAXX(FILTER(ALLSELECTED('Table'),[Date_of_actual]<MAX('Table 2'[Date])),[Date_of_actual])
return CALCULATE(SUM('Table'[Cumulative_Actual]),FILTER('Table',[Date_of_actual]=a))

3.Put the date of table2 to the slicer.

Note:there is no relationship between two tables.

Output

vxinruzhumsft_0-1694744647579.png

Best Regards!

Yolo Zhu

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

 

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.