Forum Discussion

aldopelaez's avatar
aldopelaez
New Member
5 years ago
Solved

Create table From another tables in Power BI with Group by

Hello.
I am a newbie in POwer bi and I have a table in which I have this data
id_peticion, FechaHoraModificacion, h_fase
1                 1/7/2021                          Inicio
1                  2/7/2021                         step1
1                  3/7/2021                        step2
1                  4/7/2021                        Fin
2                  1/7/2021                        Inicio
2                  2/7/2021                        step1
2                 2/7/2021                          step2
2                 3/7/2021                          Fin

And I would need to create another table in power bi with this data from the previous table

id_peticion, apertura cierre
1                1/7/2021 4/7/2021
2               1/7/2021 3/7/2021

The query in SQL would be this but I do not have permissions in the DB to create views or tables so I need to create the table in power bi


select id_peticion, min(FechaHoraModificacion) as apertura, max(FechaHoraModificacion) as cierre
from crmpowerbi
Where (h_fase='Inicio' or h_fase='Fin')
group by id_peticion

Could someone tell me how to do this?
Thanks