Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I would like to create below switch statement using column. I have tried, but it's not showing the values. If it's possible please let me know
SWITCH(
TRUE(),
SELECTEDVALUE(Columns_names[Query1])="A",FIRSTNONBLANK(Orders[A],1),
SELECTEDVALUE(Columns_names[Query1])="B",FIRSTNONBLANK(Orders[B],1),
SELECTEDVALUE(Columns_names[Query1])="C",FIRSTNONBLANK(Orders[C],1),
"Nothing")
Thanks in advance
I have a suspicion that you are likely not using SELECTEDVALUE correctly but that is really hard to say without context. If you are trying to do this in a calculated column for example, I would not use SELECTEDVALUE in that case, I would just use the column name. Also, using SWITCH TRUE here technically does not make sense, just use the standard form of SWITCH. So you might try:
Column =
SWITCH(
[Query1],
"A",FIRSTNONBLANK(Orders[A],1),
"B",FIRSTNONBLANK(Orders[A],1),
"C",FIRSTNONBLANK(Orders[A],1),
"Nothing"
)
If this is a measure, I would try this:
Measure =
SWITCH(
MAX('Columns_names'[Query1]),
"A",FIRSTNONBLANK(Orders[A],1),
"B",FIRSTNONBLANK(Orders[A],1),
"C",FIRSTNONBLANK(Orders[A],1),
"Nothing"
)
From the below Actual output if we select any value from Input_Groups, it's reflecting the same in the table visual, let's say if i select All, it will appeare in the table , same other values also.
But my requirement is if i dont select any values from Input_Groups it has to come like below output with aggerated values else by default it has to display "ALL". With All we can see aggregated values.
Usevally what i was doing, by default selecting the "All" values and deploying into the services. But if user remove the filter from the Input_Groups it will give all detailes values and aggreageted values will split .
Sample File: https://drive.google.com/file/d/1I4iiRDKf-H9vQ0vU4BTtGpn-Ey0YeiT/view?usp=sharing
If it's possible please let me know.
Thanks in advance
After looking at your PBIX it strikes me that you might possibly want to unpivot your three columns to obtain a single column and then things will be easier. I would try this, but I do not have your Sample.xlsx file so I cannot test this out. But, I'm pretty sure that unpivoting would pretty much make this a cake walk.
I have attached xlsx file. could u pleaase check and lt me know the solutions.
Sample PBIX : https://drive.google.com/file/d/1I4iiRDKf-H9vQ0vU4BTtGp-Ey0YehiT/view?usp=sharing
Sample.xlsx file : https://drive.google.com/file/d/1brZTsnfqx0mTryREYkTrb5PreaC5mO8a/view?usp=sharing
Regards,
Hari
When you this calculation in measure context is very important. Can you share sample data and sample output.
In between try
var _max = maxx(Columns_names,SELECTEDVALUE(Columns_names[Query1]))
SWITCH(
TRUE(),
_max="A",FIRSTNONBLANK(Orders[A],1),
_max="B",FIRSTNONBLANK(Orders[B],1),
_max="C",FIRSTNONBLANK(Orders[C],1),
"Nothing")
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |