Forum Discussion
Distinct between 2 tables
- 8 years ago
Hi farinabrn,
I have wrote this sql query trying to find a way to convert it to DAX but i'm noob lol
SELECT v.YEAR, v.WEEK, v.REGION, v.COMPANY, v.STORE
((SELECT COUNT(1) FROM PRODUCT) - COUNT(DISTINCT p.ID)) AS prod
FROM SALES v
LEFT JOIN PRODUCT p ON p.ID = v.PRODUCT_ID
GROUP BY v.YEAR, v.WEEK, v.REGION, v.COMPANY, v.STOREInstead of converting the sql query to DAX, you should be able to directly use the sql query in SQL statement option when GetData to a new table to your model. :smileyhappy:
Regards
Hi farinabrn,
I have wrote this sql query trying to find a way to convert it to DAX but i'm noob lol
SELECT v.YEAR, v.WEEK, v.REGION, v.COMPANY, v.STORE
((SELECT COUNT(1) FROM PRODUCT) - COUNT(DISTINCT p.ID)) AS prod
FROM SALES v
LEFT JOIN PRODUCT p ON p.ID = v.PRODUCT_ID
GROUP BY v.YEAR, v.WEEK, v.REGION, v.COMPANY, v.STORE
Instead of converting the sql query to DAX, you should be able to directly use the sql query in SQL statement option when GetData to a new table to your model. :smileyhappy:
Regards