Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
I have this query in SQL.
LeadTimeMetPctCurrentPeriod = COALESCE(CAST(CASE WHEN TotalOrdersLTMetPeriodToDate = 0 OR TotalOrderUnitsPeriodToDate = 0 THEN 0
ELSE 1 - (CAST(TotalOrdersLTMetPeriodToDate AS DECIMAL(19,3)) / CAST(TotalOrderUnitsPeriodToDate AS DECIMAL(19,3)))
END AS DECIMAL(19,3)), 0)
COALESCE(SUM(CASE WHEN dte.IsPeriodToDate = 'Yes' AND dte.IsCurrentPeriod = 'Yes' THEN MetLeadTime ELSE 0 END), 0) AS TotalOrdersLTMetPeriodToDate
COALESCE(SUM(CASE WHEN dte.IsPeriodToDate = 'Yes' AND dte.IsPreviousPeriod = 'Yes' THEN MetLeadTime ELSE 0 END), 0) AS TotalOrdersLTMetPreviousPeriodToDate
How do I convert this to a DAX measure?
Hi @mtran1210 ,
Are this several columns on your SQL or a single column? It seems that you are making use of several columns.
In this case you would need something similar to this:
LeadTimeMetPctCurrentPeriod =
COALESCE (
IF (
Table.[TotalOrdersLTMetPeriodToDate] = 0
|| Table.[TotalOrderUnitsPeriodToDate] = 0,
0,
1
- DIVIDE (
( Table.[TotalOrdersLTMetPeriodToDate] ),
Table[TotalOrderUnitsPeriodToDate]
)
),
0
)
TotalOrdersLTMetPeriodToDate =
COALESCE (
IF (
Table.[IsPeriodToDate] = "Yes"
&& Table.[IsCurrentPeriod] = "Yes",
Table[MetLeadTime],
0
),
0
)
TotalOrdersLTMetPreviousPeriodToDate =
COALESCE (
IF (
Table[IsPeriodToDate] = "Yes"
&& Table[IsPreviousPeriod] = "Yes",
Table[MetLeadTime],
0
),
0
)
If we are talking about measure then this needs to be calculated in a different way.
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsJoin us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 22 | |
| 22 | |
| 18 | |
| 17 | |
| 13 |
| User | Count |
|---|---|
| 61 | |
| 52 | |
| 47 | |
| 41 | |
| 38 |