Forum Discussion

PowerRobots99's avatar
PowerRobots99
Icon for Helper II rankHelper II
2 years ago
Solved

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
  • Anonymous's avatar
    Anonymous
    2 years ago

    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.

10 Replies

  • 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.

     

    • PowerRobots99's avatar
      PowerRobots99
      Icon for Helper II rankHelper II

      Thank you for your reply,

      Could you please share .pbix file, many thanks..

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        You are welcome.  I have already shared the formula.  I do not have the PBI file.

  • NaveenGandhi's avatar
    NaveenGandhi
    Icon for Memorable Member rankMemorable Member

    @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

    • PowerRobots99's avatar
      PowerRobots99
      Icon for Helper II rankHelper II

      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,