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 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!
Check out the February 2025 Power BI update to learn about new features.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
84 | |
69 | |
68 | |
39 | |
39 |