Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Expand table rows by dates range from next row with group

Hi everyone, hope your are good !

 

I struggle with some manipulation :

In this i.e i want to transform dynamically this table : 

IDDT_DATETP_EVENT
101/01/2023OPEN
114/01/2023CLOSE
115/01/2023RE-OPEN
115/01/2023EXCEPTION
118/01/2023CLOSE
120/01/2023RE-OPEN
205/01/2023OPEN
210/01/2023EXCEPTION
217/01/2023CLOSE
317/01/2023OPEN
325/03/2023CLOSE

 

To this :

 

IDDT_DATETP_EVENT
101/01/2023OPEN
102/01/2023OPEN
103/01/2023OPEN
104/01/2023OPEN
105/01/2023OPEN
106/01/2023OPEN
107/01/2023OPEN
108/01/2023OPEN
109/01/2023OPEN
110/01/2023OPEN
111/01/2023OPEN
112/01/2023OPEN
113/01/2023OPEN
114/01/2023CLOSE
115/01/2023RE-OPEN
115/01/2023EXCEPTION
116/01/2023EXCEPTION
117/01/2023EXCEPTION
118/01/2023CLOSE
119/01/2023CLOSE
120/01/2023RE-OPEN
205/01/2023OPEN
206/01/2023OPEN
207/01/2023OPEN
208/01/2023OPEN
209/01/2023OPEN
210/01/2023EXCEPTION
211/01/2023EXCEPTION
212/01/2023EXCEPTION
213/01/2023EXCEPTION
214/01/2023EXCEPTION
215/01/2023EXCEPTION
216/01/2023EXCEPTION
217/01/2023CLOSE
317/01/2023OPEN
318/01/2023OPEN
319/01/2023OPEN
320/01/2023OPEN
321/01/2023OPEN
322/01/2023OPEN
323/01/2023OPEN
324/01/2023OPEN
325/03/2023CLOSE

 

In DAX; power query or even SQL as you prefer, someone can help me ?

 

Thanks in advance !

 

BR 

 

Julien

2 Replies

  • Anonymous , Create a date table and join date of date with Dt_date

     

    new table

     

    Date = calendarauto()

     

    then have measures like

     

    calculate(lastnonblankvalue(Table[DT_DATE], max(tbale[TP_EVENT])), filter(all('Date'), 'Date'[Date]<= max('date'[Date])))

     

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, 

       

      Thanks for your suggestion but unfortunatelly it's not the solution i aking for.

       

      I want to expand the table row from date to next date row by ID, dynamicly...

       

      BR