Forum Discussion
Reetz
5 years agoHelper II
Switch function not working with a slicer
Have been trying to figure this out, watched videos etc, but still can't get this to work. I have a Customer Orders Table for Jan & Feb 2020 and need to annualize Customer Sales and place them in do...
- 5 years ago
Reetz
5 years agoHelper II
sorry. not sure why my links are not working. Hoping these help.
I have 2 Tables: Customer Sales & Sales Buckets
Customer Sales Table
|
|
This is an image of my fields and measures:
my 4 measures are :
m_annualized Sales =
var TTLSales=CALCULATE(SUM('Customer Sales'[Sales]))
return DIVIDE(TTLSales,2)*12
m_annualized Sales bucket =
if([m_annualized Sales]<250,"<250",
IF(AND([m_annualized Sales]>=250,[m_annualized Sales]<=499),"250-499",
IF(AND([m_annualized Sales]>=500,[m_annualized Sales]<=999),"500-999",
IF(AND([m_annualized Sales]>=1000,[m_annualized Sales]<=4999),"1000-4999",
">=5000"))))
m_Sales all measures =
SWITCH([m_Selected Value],
"<250",[m_annualized Sales bucket]="<250",
"250-499",[m_annualized Sales bucket]="250-499",
"500-999",[m_annualized Sales bucket]="500-999",
"1000-4999",[m_annualized Sales bucket]="1000-4999",
">=5000",[m_annualized Sales bucket]=">=5000")
m_Selected Value = SELECTEDVALUE('Sales Buckets'[Sales Bucket to Display])
My Slicer uses the field Sales Bucket to Display.
Reattaching my power bi screen print. In the example below, by selecting slicer option 500-999, my Sales Bucket Table should only show customer # 4. I'm just not sure what i'm doing wrong.
Ashish_Mathur
5 years agoSuper User
- Reetz5 years agoHelper II
This is Great!!!! Thank you! Just curious, I thought I had to use the Switch function to make this work. Is this just a different approach?
Thanks again!!
- Ashish_Mathur5 years agoSuper User
Thank you. Yes, a completely different appraoch based on measures only and of course a disconnected table.