Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hola necesito pasar de codigo dax a sql lo siguiente:
Solved! Go to Solution.
Hi @Anonymous ,
I'm not an expert on SQL but to my knowledge you need to have a select as a filter or similar to get the data so you would need something similar to:
Select
MIN (table1.PhaseStatus),
table1.DateTime
From
'Ventas' as table1
Where
table1.dtmData =
(
Select
mAX ( table2.DateTime) as datemax
from
'Ventas' table2
)
group by
table1.DateTime
Be aware that the allselected is a way of getting filtered data in DAX so if you need to filter the information you need to had values to it.
This table will only give you a single value because it's picking up the maximum date of the table and returning the minimum value for that date if you want the minimum value for all the dates in your table you should use the following SQL:
Select
MIN (table1.PhaseStatus),
table1.DateTime
From
'Ventas' as table1
group by
table1.DateTime
This will return a table with all dates and for each one the minimum value.
@Greg_Deckler 👍 I'm not an expert in SQL probably there are some gurus outthere in the forum but I can make my way around it, thanks for the shout out.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português@Anonymous - Probablemente no sea el mejor foro para eso, no estoy seguro de quién es el experto residente de SQL @MFelix ?
Hi @Anonymous ,
I'm not an expert on SQL but to my knowledge you need to have a select as a filter or similar to get the data so you would need something similar to:
Select
MIN (table1.PhaseStatus),
table1.DateTime
From
'Ventas' as table1
Where
table1.dtmData =
(
Select
mAX ( table2.DateTime) as datemax
from
'Ventas' table2
)
group by
table1.DateTime
Be aware that the allselected is a way of getting filtered data in DAX so if you need to filter the information you need to had values to it.
This table will only give you a single value because it's picking up the maximum date of the table and returning the minimum value for that date if you want the minimum value for all the dates in your table you should use the following SQL:
Select
MIN (table1.PhaseStatus),
table1.DateTime
From
'Ventas' as table1
group by
table1.DateTime
This will return a table with all dates and for each one the minimum value.
@Greg_Deckler 👍 I'm not an expert in SQL probably there are some gurus outthere in the forum but I can make my way around it, thanks for the shout out.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThe Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 36 | |
| 34 | |
| 31 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 103 | |
| 67 | |
| 65 | |
| 56 |