Forum Discussion
Distinctcount with sum filter
- 2 years ago
For your information, I succeeded in doing this:
VAR __tmpTable = SUMMARIZE(Table,Table[Name] ,"__Brands",SUM(Table[Quantity]))RETURN CALCULATE(DISTINCTCOUNT(Table[Name]), FILTER(__tmpTable, [__Brands]<20))
To create a measure that gives you a separate count when the sum of the number column is less than 20, you can use the following DAX formula:
Measure = CALCULATE(DISTINCTCOUNT(Table[Name]), SUM(Table[Number]) < 20)
This formula uses the CALCULATE function to filter the table based on the condition that the sum of the Number column is less than 20. The DISTINCTCOUNT function then counts the number of unique values in the Name column that meet this condition.
Regarding your question about the page slicer, the measure will be dynamic depending on the choice in the slicer as long as all the data is in the same table.
I hope this helps! Let me know if you have any further questions.
- UserSam1232 years agoHelper I
Hello,
Thanks for the feedback, but I've already used this formula and it didn't work, which is why I'm coming to you.
I use this one and it returns null. When I use yours, it sends me this error message: True/False expression doesn't specify a column
- 123abc2 years agoCommunity Champion
I’m sorry to hear that the formula I provided didn’t work for you. The error message “True/False expression doesn’t specify a column” usually occurs when each True/False expression used as a table filter expression must refer to exactly one column 1.
Based on the screenshot you provided, it looks like you are using an IF statement in your formula. If this is the case, you may need to wrap your IF statement in a FILTER function to fix the issue 1. Here’s an example of how you can modify the formula:
Measure = CALCULATE(DISTINCTCOUNT(Table[Column]), FILTER(Table, SUM(Table[Number]) < 20))
This formula uses the FILTER function to filter the table based on the condition that the sum of the Number column is less than 20. The DISTINCTCOUNT function then counts the number of distinct values in the Column column for the filtered table.
Regarding your question about the Date column being a page slicer, the measure will be dynamic depending on the choice in the slicer as long as all the data is in the same table.
I hope this helps! Let me know if you have any further questions.
- UserSam1232 years agoHelper I
I don't understand why you're asking me to change my formula for yours when there's absolutely no change between mine and yours.
What's more, this formula doesn't work, it returns "null".