Forum Discussion

Marwen89's avatar
Marwen89
Frequent Visitor
4 years ago
Solved

Copy lastnonblank value for future date

Hi,  I want to copy lastnonblank value for future date.  For exemple: Lastnonblank value 100 at 22 February 2022, I want to copy it for all periode >this date.  How to do this with Dax?    Any...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Marwen89 ,

     

    Power BI doesn't support you to transform the existing column by Dax. You need to create a new column by Dax to achieve your goal.

    Try this code to create calculated columns.

    Fill Down CANADA = 
    VAR _Last = CALCULATE(LASTNONBLANKVALUE('Table'[Date], SUM('Table'[CANADA])), ALLSELECTED())
    return
    IF('Table'[CANADA] = BLANK(),_last,'Table'[CANADA])
    Fill Down EUROPE = 
    VAR _Last = CALCULATE(LASTNONBLANKVALUE('Table'[Date], SUM('Table'[EUROPE])), ALLSELECTED())
    return
    IF('Table'[CANADA] = BLANK(),_last,'Table'[EUROPE])

    Result is as below.

     

    Best Regards,
    Rico Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.