Forum Discussion
Filtering on a Card
Thanks for your quick response! Below is a screen show of the card and filters:
The card above is based on a distinct count of territories. 24 is the total, but I want to only show the number of territories that have a variance that is greater than zero. But as you can see, the "$ Variance" filter is greyed out.
My data (in a table view) looks as follows, the data in this table is aggregated based on detailed rows. (On the left are the territory names, I have cut off most of them). I want the care to only show the total territories that have a "$ Variance" >0
Let me know if you need additional information.
Thanks
Greg
- GregMorgan5 years agoNew Member
My first screen shot did not post for some reason, please see below:
- vanessafvg5 years agoCommunity Champion
that doesn't look greyed out to me have you tried to drop it down?
you could however manage this with a dax calculation
Unique Territories with variance =
VAR varonly =
IF ( SUM ( table[variance] ) > 0, 1, 0 )
RETURN
CALCULATE (
DISTINCTCOUNT ( table[territory] ),
FILTER ( table, variances = 1 )
)- GregMorgan5 years agoNew Member
Thanks. It is definitely greyed out (hard to see in the screen shot). For some reason, Power BI will not allow a filtering a value on a distinct count of another column. (I have seen other users comment onthis as well).
I tried your solution and set up a new measure as follows:
Unique Territories with variance =
VAR varonly =
IF ( SUM ( 'SalesbyTerritory'[Variance] ) > 0, 1, 0 )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'SalesbyTerritory'[Territory] ),
FILTER ( SalesbyTerritory, SalesbyTerritory[Variance] = 1 )
)
When I add this to my card, I just get '(Blank)'. I am sure I am doing something wrong, are you able to determine the issue based on the code above?
Thanks again!