Search code examples
powerbidax

Displaying latest date until a new data upload happens


Hello everyone i have a table that contains text, the table name is "top_issue"

Existing data:

Upload Date Created At issue
2024-07-01 2024-07-01 the files are bugged
2024-07-01 2024-07-01 Issue 1
2024-07-02 2024-07-02 Issue 2
2024-07-02 2024-07-02 Issue 3
2024-07-03 2024-07-03 Issue 4
2024-07-03 2024-07-03 Issue 5
2024-07-03 2024-07-03 Issue 6
2024-07-04 2024-07-04 Issue 7
2024-07-04 2024-07-04 Issue 8
2024-07-04 2024-07-04 Issue 9
2024-07-04 2024-07-04 Issue 10

I want to show when it's on 4th, 5th July, and onwards appears like this

Upload Date Created At issue
2024-07-04 2024-07-04 Issue 7
2024-07-04 2024-07-04 Issue 8
2024-07-04 2024-07-04 Issue 9
2024-07-04 2024-07-04 Issue 10

If there's a new data upload on 10th July it will appear like this:

Upload Date Created At issue
2024-07-10 2024-07-10 Issue 11
2024-07-10 2024-07-10 Issue 12

Here is my exsiting DAX:

CALCULATE(max(top_issue[created_at]),ALL(top_issue))

Is there any change that i need to use?


Solution

  • you can update the measure like below.

    MEASURE =
    VAR _maxdate =
        MAX ( 'DimDate'[Date] )
    VAR _maxdate2 =
        MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Created At] <= _maxdate ),
            'Table'[Created At]
        )
    RETURN
        IF ( MAX ( 'Table'[Created At] ) = _maxdate2, "y" )
    

    enter image description here


    MEASURE =
    VAR _maxdate =
        date(selectedvalue(year),selectedvalue(month),selectedvalue(day))
    VAR _maxdate2 =
        MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Created At] <= _maxdate ),
            'Table'[Created At]
        )
    RETURN
        IF ( MAX ( 'Table'[Created At] ) = _maxdate2, "y" )