Forum Discussion
IvanMislav
7 years agoHelper I
Dynamic label based on custom measure
Hi, i have a simple data model. Something like company name, income, expenses. I created a custom measure Balance = income - expenses. What I want to do is create a dynamic lable: if bala...
Greg_Deckler
7 years agoCommunity Champion
You could do this:
Label =
SWITCH(TRUE(),
[Balance]<0,"negative",
[Balance]>0,"positive",
"zero"
)
NegativeCount =
VAR __table = SUMMARIZECOLUMNS('Table19'[Company],'table19',"__balance",[Balance])
RETURN
COUNTX(FILTER(__table,[__balance]<0),[Company])
See attached Table 19, Page 11
IvanMislav
7 years agoHelper I
Hi, Greg!
Thank you for your answer. I can't find the attached table.
- Greg_Deckler7 years agoCommunity Champion
Whoops, forgot to attach.
- IvanMislav7 years agoHelper I
Thanks, I can see the file now.
This works when there are unique values for companies. In my table company name values are not unique.
- Greg_Deckler7 years agoCommunity Champion
Works for me. See updated attachment. Not sure why you would get different results. Perhaps share your sample data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490