Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all,
I have multiple columns representing services which have prices and null values. A null value means that the company does not provide the service. See Example table below. I want to make a simple slicer for all services in which I can select "True" or "False" (see second table, which is a mockup for my slicer). If I select True for Service 1 for instance, it shows all companies which have a price. If I select false, I want to see all the companies with null values.
The only way I can come up with is by creating an extra column in Power Query for every service and use the formula:
if value <> null then "TRUE" else "FALSE".
But this results in a lot of extra columns and thus extra loading time. There has to be a way in which I can slice and dice in an easier way?
Service 1 | Service 2 | |
Company A | € 1.50 | null |
Company B | null | null |
Company C | € 2.00 | € 3.00 |
Company D | € 3.00 | € 5.00 |
Solved! Go to Solution.
Hi @Anonymous ,
If you don't want to create a new column. You can create a simple table by entering data.
Based on my test, the returned value must be Company or Service. If it is changed to Value, there will be an error.
Company1 =
SWITCH (
SELECTEDVALUE ( 'Table (2)'[T/F] ),
"True", CALCULATE ( MAX ( 'Table'[Company] ), FILTER ( 'Table', [Value] <> BLANK () ) ),
"False", CALCULATE ( MAX ( 'Table'[Company] ), FILTER ( 'Table', [Value] = BLANK () ) )
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
If you don't want to create a new column. You can create a simple table by entering data.
Based on my test, the returned value must be Company or Service. If it is changed to Value, there will be an error.
Company1 =
SWITCH (
SELECTEDVALUE ( 'Table (2)'[T/F] ),
"True", CALCULATE ( MAX ( 'Table'[Company] ), FILTER ( 'Table', [Value] <> BLANK () ) ),
"False", CALCULATE ( MAX ( 'Table'[Company] ), FILTER ( 'Table', [Value] = BLANK () ) )
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous the best would be to unpivot your table and then add the True/False column. To unpivot, select the Company column, right-click and then unpivot other columns. It will give you two columns Attribute and Value and now you can add True/False column.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
In visualization, now you have the option to select service and also true/false for that service.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @Anonymous ,
My first suggestion for such case would be to unpivot columns with services. In this case you will have just 2 columns: service name and value. Other part would be very easy in this case.
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
But this way if I create a slicer I still will get a lot of options (null, 2 euros, 3 euro's) for a service, while I only wish to see True/False
@Anonymous ,
True/False is the "other part".
After unpivoting columns you can create a new custom column with the logic you need:
Add column - Custom Column:
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
User | Count |
---|---|
128 | |
108 | |
100 | |
64 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |