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.
I am needing help with a complex formula needed for error checking. This all needs to be done in DAX (not in the Query editor) as there are dynamic filters in the report that need to impact these counts. Example of dynamic filter is Status toggle for user to select X or not X.
I need to count the number of ID's associated with a sold-to and return a count of sold-to if that first count is greater than 1.
Sold to| ID|Status
1 | A |X
2 | B |
3 | C |
1 | D |
1 | E |
2 | F |X
Returns counts of
1 | 3
2 | 2
3 | 1
Filter for > 1 -- Sold to # 1 has 3 associated ID's which is an error
1 | 3
2 | 2
Next I need to be able to roll all of these up to a single filter (set any count > 1 to "Filter)
Hi @bvanevr,
Create a simple measure like this:
ID count = DISTINCTCOUNT(TableName[ID])
Add field [Sold to] and measure [ID count] into table visual, add field [status] into slicer. Click the table visual, apply a visual level filter like below.
Best regards,
Yuliana Gu
Hi @bvanevr
Try this
Go to Modelling Tab and press the "NEW TABLE" button
New Table = FILTER ( SUMMARIZE ( TableName, TableName[Sold to], "ID Count", DISTINCTCOUNT ( TableName[ID] ) ), [ID Count] > 1 )
Thanks for the fast response
I was able to create the table, but it does not allow for dynamic filtering from within the report. For example if the user does not want status = X In that case the count for Sold-to = 1 would not be 3 but 2 and Sold to = 2 would be 1 and would be filtered out.
Returns counts of
1 | 2
2 | 1
3 | 1
Filter for > 1 -- Sold to # 1 has 2 associated ID's which is an error
1 | 2
Hi, Use this Measure in the Table. Then you can add a slicer for Status
ID Count = CALCULATE ( DISTINCTCOUNT ( TableName[ID] ), FILTER ( VALUES ( TableName[Sold to] ), CALCULATE ( DISTINCTCOUNT ( TableName[ID] ) > 1 ) ) )
Thanks Zubair,
I was able to replicate your solution.
Would you be able to help with 2 phase of my question? I need to be able to provide users with an item to click that would act as a filter to only display those records >1 independent of the dynamic filter for Status. Idealy a table with one value "Click to Filter Mult IDs".
In the past I used a 2nd table to map values, but since we are generating the count on the fly so the count is not a column in the ingested table, I cant create a relationship on the count.
Hi,
You can add an ID_Count calculated column as well. Then you can use it a slicer for Users to select records>1
ID_Count = CALCULATE ( DISTINCTCOUNT ( TableName[ID] ), FILTER ( TableName, TableName[Sold to] = EARLIER ( TableName[Sold to] ) ) )
thanks @v-yulgu-msft for the reply.
I was able to reproduce result, but would really like a spreadsheet way of doing this. How my scorecard currently works is
The 6 is coming from a Card and the "Filter" is a spreadsheet filtered to include only "Filter. This allows the user to see the count of Sold to failing a rule and then click "Filter" to see the associated records. Based on prior answers i was able to get the "Filter" to display, but it does not complress to a single line
I hope this makes sense to you.
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 |
---|---|
106 | |
98 | |
80 | |
67 | |
63 |
User | Count |
---|---|
145 | |
111 | |
104 | |
84 | |
64 |