Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello,
I am trying to write a function that will switch columns based on a given slicer selection.
My slicer is a disconnected table that has only two variables in it: Allocated and Not Allocated.
The two columns I am switching between are as follows:
Consignee Parent: is from a database so it is just a list of parents
Allocated Consignee Parent: a column from Power Query in which I duplicated Consignee Parent and replaced "X Distribution" with BLANK().
Here is my switching function (a calculated column) in question:
The problem is that even though I am engaging the slicer, it remains on Consignee Parent the entire time.
What I'm wanting it to do is either remove or add X Distribution to the rows of my matrix.
Thank you and I look forward to your responses.
@ofoster , A calculated column can not use a slicer value.
You can have table with these two values and use the value to switch the measures
example
W/WO X = SWITCH(SELECTEDVALUE('Allocation'[Commerce Allocation]),"Allocated", count('Consignee Parent'[Allocated Consignee Parent]), Count('Consignee Parent'[Consignee Parent]))
I used this solution as a jumping board to make a usable solution. I created a measure in the same format, but instead of the columns, "Allocated Consignee Parent" and "Consignee Parent", I created two calculated columns "Alllocated Binary" and "Binary".
Their equations are as follows:
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 46 | |
| 31 | |
| 29 | |
| 15 | |
| 15 |
| User | Count |
|---|---|
| 58 | |
| 57 | |
| 38 | |
| 21 | |
| 21 |