The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All
I am trying to understand how countx and sum x works. In the matrix how is the sum x example 1 total 279?
The columns that use countx make sense
The In progress count column i don't get understand. Target has 3 learners in progress so why does it count 1 instead of 3?
Dax formulas -
count x example 1 = COUNTX(LearningPlan,COUNT(LearningPlan[LearnerID]))
sum x example 1 = sumx(VALUES(LearningPlan[Employer name]),COUNT(LearningPlan[LearnerID]))
x test = sumx(VALUES(LearningPlan[Employer name]),[count_x test])
count_x test = COUNT(LearningPlan[LearnerID])
in progress count = COUNTX(VALUES(LearningPlan[EmployerID]),CALCULATE(COUNT(LearningPlan[EmployerID]),LearningPlan[Status] = "In Progress"))
Here is my sample data
LearnerID | LearnerName | Start Date | Planned End | Status | EmployerID | Employer name | Completion Date | Withdrawal Date | Include in ILR? |
1 | Bob J | 01/03/2020 | 19/06/2021 | Withdrawn | 1 | JD Sports | 04/02/2020 | Yes | |
2 | Sidney D | 02/04/2020 | 21/07/2021 | Withdrawn | 1 | JD Sports | 13/01/2021 | Yes | |
3 | Josh A | 01/03/2020 | 19/06/2021 | Withdrawn | 1 | JD Sports | 19/06/2020 | Yes | |
4 | Christian R | 14/03/2020 | 02/07/2021 | Withdrawn | 1 | JD Sports | 17/07/2020 | Yes | |
5 | Tommy H | 18/03/2021 | 06/07/2022 | Withdrawn | 2 | Barrys Emporium | 10/06/2021 | Yes | |
6 | Bruce D | 19/09/2020 | 07/01/2022 | Withdrawn | 2 | Barrys Emporium | 11/11/2020 | Yes | |
7 | James H | 16/09/2023 | 03/01/2025 | Withdrawn | 2 | Barrys Emporium | 19/09/2023 | Yes | |
8 | Angus Y | 12/12/2020 | 01/04/2022 | Withdrawn | 2 | Barrys Emporium | 03/03/2023 | Yes | |
9 | Marshall M | 03/09/2019 | 21/12/2020 | Withdrawn | 3 | Target | 10/10/2020 | Yes | |
10 | Barry K | 15/06/2023 | 02/10/2024 | Withdrawn | 3 | Target | 08/08/2023 | Yes | |
11 | Tony K | 30/04/2019 | 17/08/2020 | Withdrawn | 3 | Target | 29/05/2019 | No | |
12 | Emily D | 11/01/2020 | 30/04/2021 | Withdrawn | 3 | Target | 02/02/2020 | Yes | |
13 | Rebecca R | 08/12/2023 | 27/03/2025 | Withdrawn | 4 | McDonalds | 11/04/2024 | Yes | |
14 | Jane S | 06/02/2023 | 26/05/2024 | Withdrawn | 4 | McDonalds | 07/02/2023 | Yes | |
15 | Amy I | 17/01/2024 | 06/05/2025 | Withdrawn | 4 | McDonalds | 11/05/2024 | Yes | |
16 | Erin S | 02/02/2023 | 22/05/2024 | Withdrawn | 4 | McDonalds | 11/02/2023 | Yes | |
17 | Bertrina D | 01/02/2022 | 22/05/2026 | Withdrawn | 5 | KFC | 17/02/2022 | Yes | |
18 | John D | 03/06/2022 | 21/09/2023 | Withdrawn | 5 | KFC | 04/08/2022 | Yes | |
19 | Tim P | 03/07/2023 | 21/10/2025 | Withdrawn | 5 | KFC | 10/07/2023 | No | |
20 | Maxine A | 11/11/2023 | 28/02/2025 | Withdrawn | 5 | KFC | 07/12/2023 | Yes | |
21 | Jasmine P | 11/11/2023 | 24/04/2024 | In Progress | 2 | Barrys Emporium | No | ||
22 | Jack D | 30/04/2019 | 10/12/2020 | In Progress | 5 | KFC | No | ||
23 | Rob K | 01/01/2018 | 23/05/2023 | In Progress | 3 | Target | No | ||
24 | Jessy J | 15/03/2017 | 23/05/2023 | In Progress | 3 | Target | No | ||
25 | Chad M | 25/04/2017 | 28/02/2024 | In Progress | 3 | Target | No | ||
26 | Mo I | 29/12/2023 | 06/03/2025 | In Proress | 10 | Burger King | Yes | ||
27 | Jason N | 09/01/2024 | 06/06/2025 | In Progress | 11 | Gillete | Yes | ||
28 | Jenny J | 22/12/2023 | 09/08/2025 | In Progress | 1 | JD Sports | Yes | ||
29 | Tom D | 18/08/2023 | 04/01/2025 | Withdrawn | 266 | Harrys | 05/01/2023 | Yes | |
30 | Courney K | 05/06/2023 | 09/11/2026 | Withdrawn | 267 | Wilkinson Sword | 21/12/2023 | Yes | |
31 | Jonathan D | 07/01/2024 | 08/06/2025 | In Progress | 4 | McDonalds | Yes |
Thanks in advance
Solved! Go to Solution.
@SBR1D , Based on what I got. Check meaning in comment
Use calculate when you use calculation in expression when you use a formula else use measure
count x example 1 = COUNTX(LearningPlan,calculate(COUNT(LearningPlan[LearnerID]))) // This one just count the row value and count it again
Better to use COUNT(LearningPlan[LearnerID])
sum x example 1 = sumx(VALUES(LearningPlan[Employer name]),calculate(COUNT(LearningPlan[LearnerID]))) // Do the count till employee name level and post that sum
sumx(VALUES(LearningPlan[Employer name]),[count_x test])
// Do the count till employee name level and post that sum
in progress count = COUNTX(VALUES(LearningPlan[EmployerID]),CALCULATE(COUNT(LearningPlan[EmployerID]),LearningPlan[Status] = "In Progress"))
// Do the count till employee name level and post that count again, means every value will be treated as 1
@SBR1D , Based on what I got. Check meaning in comment
Use calculate when you use calculation in expression when you use a formula else use measure
count x example 1 = COUNTX(LearningPlan,calculate(COUNT(LearningPlan[LearnerID]))) // This one just count the row value and count it again
Better to use COUNT(LearningPlan[LearnerID])
sum x example 1 = sumx(VALUES(LearningPlan[Employer name]),calculate(COUNT(LearningPlan[LearnerID]))) // Do the count till employee name level and post that sum
sumx(VALUES(LearningPlan[Employer name]),[count_x test])
// Do the count till employee name level and post that sum
in progress count = COUNTX(VALUES(LearningPlan[EmployerID]),CALCULATE(COUNT(LearningPlan[EmployerID]),LearningPlan[Status] = "In Progress"))
// Do the count till employee name level and post that count again, means every value will be treated as 1