Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I need to create a measure using DAX that has the sum of the qty, I should take the max date of the table that is between two other dates (Date Slicer) based on the column name, For exemple if the selected date of the slicer is between 24/6/2020 and 20/3/2021
the result should be
Thank you.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Expected result Date: =
CALCULATE (
SELECTEDVALUE ( 'Calendar'[Date] ),
INDEX (
1,
SUMMARIZE ( ALLSELECTED ( Data ), 'Name'[Name], 'Calendar'[Date], Data[Qty] ),
ORDERBY ( 'Calendar'[Date], DESC, Data[Qty], DESC ),
KEEP,
PARTITIONBY ( 'Name'[Name] )
)
)
Expected result Qty: =
CALCULATE (
SUM(Data[Qty]),
INDEX (
1,
SUMMARIZE ( ALLSELECTED ( Data ), 'Name'[Name], 'Calendar'[Date], Data[Qty] ),
ORDERBY ( 'Calendar'[Date], DESC, Data[Qty], DESC ),
KEEP,
PARTITIONBY ( 'Name'[Name] )
)
)
Thank you a lot for your help, but I don't know why it's not working for me
Hi,
just in case, please check the version of the power bi desktop.
December 2022
Now the pbix works, but this is not what I have to get, when selecting the date(in the slicer) I need to get the qty of the max date of the name that is between the selected date, for exp for B I need to take the Qty=50(it correspond to the max date (Sat, 30 Jan 2021 00:00:00 between the selected date of the slicer)
The Expected result date is correct date, now I have to take the qty that corresponds to it.