Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
This is my data table:
I need to have a disctinc count of employees IDs but only count when the instance where they appear is less than or equal to three, and only count the minor instance.
For example, when I click on "Name 5," I only need to see a count in number 1 (green) and nothing on the 2 (red).
I've a partial working DAX, which already makes the function on only counting the distinct ID of instances less than or equal to three. But the second condition is missing.
DCount IDs of grade >3 =
CALCULATE(
DISTINCTCOUNT('Append'[Employee ID]),
FILTER(
'Append',
'Append'[Standard Value] <= 3
)
)
Solved! Go to Solution.
@amitchandak , your response although not the solution, guided me through the right path.
The key here was the VAR selValue which applied the correct context when used in a Matrix and replaced the SUM for a MIN.
Also, I didn't hard code the value "3", in its place I used a parameter.
Here is the final DAX that did the trick:
DCount GUID min with parameter =
VAR selValue = SELECTEDVALUE('Append'[Standard Value])
VAR Calc=
COUNTX(
FILTER(
SUMMARIZE(
ALLSELECTED('Append'),
'Append'[Employee GUID],
'Append'[UniqueID],
"Min", MIN('Append'[Standard Value])
),
[Min] <= [Parameter Value] &&
[Min] = selValue
),
[Employee GUID]
)
RETURN
Calc
Hi @Oscar_Mtz_V ,
Here the selection is sum of instance.
It should be correct that the corresponding data in the table is 2.
If you want to show the distinct count, please select count(distinct).
If I misunderstood your meaning, please share more details.
Best Regards,
Jay
@v-jayw-msft , it is a bit more complex than that, please see the thread of responses where the issue is explained.
@Oscar_Mtz_V , Try a measure like
Countx(Filter(summarize(Table, Table[Employee Name], Table[Standard Value], "_1", sum(Table[Value])), [_1] <3), [Employee Name])
@amitchandak , your response although not the solution, guided me through the right path.
The key here was the VAR selValue which applied the correct context when used in a Matrix and replaced the SUM for a MIN.
Also, I didn't hard code the value "3", in its place I used a parameter.
Here is the final DAX that did the trick:
DCount GUID min with parameter =
VAR selValue = SELECTEDVALUE('Append'[Standard Value])
VAR Calc=
COUNTX(
FILTER(
SUMMARIZE(
ALLSELECTED('Append'),
'Append'[Employee GUID],
'Append'[UniqueID],
"Min", MIN('Append'[Standard Value])
),
[Min] <= [Parameter Value] &&
[Min] = selValue
),
[Employee GUID]
)
RETURN
Calc
Kudos to you !!
@amitchandak , thanks for your message, the propossed DAX is still not showing the desired results.
When I click on "Name 5" on the above table, this should only count the number 1
Via DAX Studio I looked into the craeted table, and this shoulb ignore the "Name 5" with value 2.
I then tried to use the minimun:
but it is not working either. As when I select "Name 5" the employee keep showin "1" count in both values.
There is something in the row context of the visual affecting the result, as in DAX studio, the table iscorrect with the MIN.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
87 | |
84 | |
68 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |