Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
SELECT
newid() AS fact_tiger_id,
comply.*,
CASE
WHEN comply.tiger_point = 4 THEN 100
ELSE 0
END tiger_percentage
FROM
(
SELECT
process.*
,(SELECT
CASE
WHEN ROUND(CAST((SUM(is_comply)/COUNT(is_comply))*100 AS DOUBLE),0) = 100 then 1
ELSE 0
END
FROM fact_tiger_process
WHERE
report_category_id = process.report_category_id
AND date_id = process.date_id
AND store_id = process.store_id
) AS comply_percategory
,(SELECT
CASE
WHEN ROUND(CAST(SUM(is_comply) AS DOUBLE),2) = 0 then 0
ELSE FLOOR(CAST((SUM(is_comply)/COUNT(is_comply))*100 AS DOUBLE))
END
FROM fact_tiger_process
WHERE
report_category_id = process.report_category_id
AND date_id = process.date_id
AND store_id = process.store_id
) AS comply_percentage_percategory
,(SELECT SUM(comply_indicator)
FROM temp_comply_indicator
WHERE
date_id = process.date_id
AND store_id = process.store_id
) AS tiger_point -- Summary total point from report category
FROM
(SELECT * FROM fact_tiger_process) process
ORDER BY process.date_id, process.visit_id
) comply
I am trying to convert this SQL script into PBI DAX into Measure. Can anyone help? Anything would be appreciated. Thanks.
Hi @Anonymous ,
Maybe you don't have to convert.
Power Query gives you the flexibility to import data from wide variety of databases that it supports. It can run native database queries, which can save you the time it takes to build queries using the Power Query interface.
For more details, please refer to
Import data from a database using native database query | Microsoft Docs
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
95 | |
94 | |
79 | |
71 | |
64 |
User | Count |
---|---|
120 | |
105 | |
99 | |
81 | |
72 |