Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply
PowerRobots99
Helper II
Helper II

Filling Blank Dates Challange

Hello Friends,

 

I am having data like this,

 

ReportDatePODate
07-08-2024107-05-2024
07-08-2024207-02-2024
07-08-2024307-01-2024
07-08-2024407-03-2024
07-08-2024507-04-2024
07-15-2024107-11-2024
07-15-20242 
07-15-2024307-10-2024
07-15-20244 
07-15-20245 
07-23-2024107-18-2024
07-23-20242 
07-23-20243 
07-23-20244 
07-23-20245 

 

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 -

 

ReportDatePODate
07-08-2024107-05-2024
07-08-2024207-02-2024
07-08-2024307-01-2024
07-08-2024407-03-2024
07-08-2024507-04-2024
07-15-2024107-11-2024
07-15-2024207-02-2024
07-15-2024307-10-2024
07-15-2024407-03-2024
07-15-2024507-04-2024
07-23-2024107-18-2024
07-23-2024207-02-2024
07-23-2024307-10-2024
07-23-2024407-03-2024
07-23-2024507-04-2024
1 ACCEPTED 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:

vlinyulumsft_0-1721822235650.png

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.

vlinyulumsft_1-1721822291557.png

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.

View solution in original post

10 REPLIES 10
Ashish_Mathur
Super User
Super User

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.

Ashish_Mathur_0-1721274195773.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

PowerRobots99_0-1721366486662.png

 

 

You are welcome.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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:

vlinyulumsft_0-1721822235650.png

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.

vlinyulumsft_1-1721822291557.png

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 😊

NaveenGandhi
Super User
Super User

@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,  

 

PowerRobots99_1-1721270357059.png

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.