March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello Friends,
I am having data like this,
ReportDate | PO | Date |
07-08-2024 | 1 | 07-05-2024 |
07-08-2024 | 2 | 07-02-2024 |
07-08-2024 | 3 | 07-01-2024 |
07-08-2024 | 4 | 07-03-2024 |
07-08-2024 | 5 | 07-04-2024 |
07-15-2024 | 1 | 07-11-2024 |
07-15-2024 | 2 | |
07-15-2024 | 3 | 07-10-2024 |
07-15-2024 | 4 | |
07-15-2024 | 5 | |
07-23-2024 | 1 | 07-18-2024 |
07-23-2024 | 2 | |
07-23-2024 | 3 | |
07-23-2024 | 4 | |
07-23-2024 | 5 |
However, i want to show most revised date value in the place of blanks based on PO,
Is there any way to achieve this using DAX while incorporating calculated column?
Desired output is as shown below -
ReportDate | PO | Date |
07-08-2024 | 1 | 07-05-2024 |
07-08-2024 | 2 | 07-02-2024 |
07-08-2024 | 3 | 07-01-2024 |
07-08-2024 | 4 | 07-03-2024 |
07-08-2024 | 5 | 07-04-2024 |
07-15-2024 | 1 | 07-11-2024 |
07-15-2024 | 2 | 07-02-2024 |
07-15-2024 | 3 | 07-10-2024 |
07-15-2024 | 4 | 07-03-2024 |
07-15-2024 | 5 | 07-04-2024 |
07-23-2024 | 1 | 07-18-2024 |
07-23-2024 | 2 | 07-02-2024 |
07-23-2024 | 3 | 07-10-2024 |
07-23-2024 | 4 | 07-03-2024 |
07-23-2024 | 5 | 07-04-2024 |
Solved! Go to Solution.
Thanks for the reply from @Ashish_Mathur and @NaveenGandhi , please allow me to provide another insight:
Hi, @PowerRobots99
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. Below are the measure I've created for your needs:
MEASURE =
VAR cc =
MAX ( 'Table'[Dates] )
VAR bb =
CALCULATE (
MAX ( 'Table'[ReportDate] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[PO] = MAX ( 'Table'[PO] )
&& 'Table'[ReportDate] < MAX ( 'Table'[ReportDate] )
)
)
VAR aa =
CALCULATE (
MAX ( 'Table'[Dates] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[PO] = MAX ( 'Table'[PO] )
&& 'Table'[ReportDate] = bb
)
)
RETURN
IF ( ISBLANK ( cc ), aa, cc )
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
This calculated column formula works
Column = COALESCE(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[PO]=EARLIER(Data[PO])&&Data[ReportDate]<EARLIER(Data[ReportDate]))),Data[Date])
Hope this helps.
Thank you for your reply,
Could you please share .pbix file, many thanks..
You are welcome. I have already shared the formula. I do not have the PBI file.
Hi Ashish,
Thank you for the reply,
However, suppose if for specific PO with data like as shown in below image,
In this case, it should give 7/5/2024 in yellow blank cell, however as per our formula it gives maximum of dates. i.e 9/17/2024, is there any way to tweak measure to give previous reporting date's date value
You are welcome. Share data in a format that can be pasted in an MS Excel file.
Thanks for the reply from @Ashish_Mathur and @NaveenGandhi , please allow me to provide another insight:
Hi, @PowerRobots99
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2. Below are the measure I've created for your needs:
MEASURE =
VAR cc =
MAX ( 'Table'[Dates] )
VAR bb =
CALCULATE (
MAX ( 'Table'[ReportDate] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[PO] = MAX ( 'Table'[PO] )
&& 'Table'[ReportDate] < MAX ( 'Table'[ReportDate] )
)
)
VAR aa =
CALCULATE (
MAX ( 'Table'[Dates] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[PO] = MAX ( 'Table'[PO] )
&& 'Table'[ReportDate] = bb
)
)
RETURN
IF ( ISBLANK ( cc ), aa, cc )
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Perfect, thank you so much 😊
@Hi @PowerRobots99
Can you share more detail on how you choose the most revised dates? You might need to explain how to choose those dates with some sample data and screenshot.
Regards,
NG
Thank you for your reply,
Please refer attached screenshot,
Dates should be calculated in place of blanks based on its corresponding PO numbers in previous report dates,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |