Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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] )
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
79 | |
52 | |
39 | |
35 |
User | Count |
---|---|
94 | |
79 | |
51 | |
47 | |
47 |