Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have the following query :
SELECT d.department
,COUNT(*)
FROM fact_table AS f
LEFT JOIN
(SELECT DISTINCT sk_dept, department FROM dim_department ) AS d ON d.sk_dept=f.fk_dept
WHERE f.employee_status <> 2
GROUP BY d.department
This is the output of the query :
Department Count
1 250
2 300
The department dimension is like below :
DepartmentSK DepartmentId SubDepartment
1 1 23
2 1 67
3 1 120
4 2 44
The Dept has sub department my measure is showing me duplicates :
Department Count
1 500
2 600
The count is duplicated because the deptid is existing many times since each department has many sub departments.
Solved! Go to Solution.
Try to SUMX with the DISTINCT to get the unique values of the department :
Employee Count By Dept = SUMX ( DISTINCT(VALUES(dim_department[department])), CALCULATE ( DISTINCTCOUNT(fact_table[employeeID]), DIM_Status[employee_status] <> 2 ) ) )
Try to SUMX with the DISTINCT to get the unique values of the department :
Employee Count By Dept = SUMX ( DISTINCT(VALUES(dim_department[department])), CALCULATE ( DISTINCTCOUNT(fact_table[employeeID]), DIM_Status[employee_status] <> 2 ) ) )
@AmiraBedh it will be easier if you provide sample data and the expected output.
Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I updated the question.