Forum Discussion
Visual that looks at fields across multiple columns
Hi everyone, I want to build a visual that looks across multiple columns and shows me what's missing, but I don't know how. For example, let's say I have the following table for my pizza orders:
| OrderID | Crust | Sauce | Cheese | Topping |
101 | Thin | Red | Mozzarella | Mushrooms |
| 102 | Flatbread | White | Mozzarella | Pepperoni |
| 103 | Thin | Havarti | ||
| 104 | Red | Mozzarella | Cheese | |
| 105 | Deep dish | Red | Fontina |
A visual that shows what's missing (my pizza business is just getting started so I only do one topping per pizza):
| OrderID | Still Needs |
| 103 | Sauce, Topping |
| 104 | Crust |
| 105 | Topping |
Thank you for your help.
Hey zbeg ,
as far as I know, there is no such visual that visualizes things that are not there.
For this reason, you might consider adding a calculated column to your table using this DAX:
is missing = --var missingCrust = IF( LEN( TRIM('Table'[ Crust] ) ) = 0 , "Crust," ) var missingCrust = IF( ISBLANK( 'Table'[ Crust] ) || LEN( TRIM('Table'[ Crust] ) ) = 0 , "Crust," )var missingSauce = IF( ISBLANK( 'Table'[ Sauce] ) || LEN( TRIM( 'Table'[ Sauce] ) ) = 0 , "Sauce," ) var missingCheese = IF( ISBLANK( 'Table'[ Cheese] ) || LEN( TRIM( 'Table'[ Cheese] ) ) = 0 , "Cheese," ) var missingTopping = IF( ISBLANK( 'Table'[ Topping] ) || LEN( TRIM( 'Table'[ Topping] ) ) = 0 , "Topping," ) var thisismissing = missingCrust & missingSauce & missingCheese & missingTopping var lastcharacter = RIGHT( thisismissing , 1 ) return IF( lastcharacter = "," , LEFT( thisismissing , LEN( thisismissing ) - 1 ) , thisismissing )The DAX looks more complicated than what might be really needed, but this is due to the spaces that have been added to the single columns from the data you provided, and I wasn't that motivated to clean the data 🙂
Nevertheless, here is a screenshot from a table visual, of course, you can just use the columns OrderID and "is missing":
Hopefully, this provides what you are looking for.
Regards,
Tom
zbeg
You can use a table visual and keep only the order ID, and add this measure:Still Needs = VAR __ItemsFound = { ("Crust",MAX(Pizza[Crust])), ("Sauce",MAX(Pizza[Sauce])), ("Cheese",MAX(Pizza[Cheese])), ("Topping",MAX(Pizza[Topping])) } VAR __ItemsNeeded = CONCATENATEX( __ItemsFound, IF( [Value2] = BLANK(), [Value1] & "," ),BLANK() ) VAR __LENGTH = LEN(__ItemsNeeded)-1 RETURN IF( __LENGTH <> -1 , LEFT(__ItemsNeeded, __LENGTH) )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
2 Replies
- TomMartensSuper User
Hey zbeg ,
as far as I know, there is no such visual that visualizes things that are not there.
For this reason, you might consider adding a calculated column to your table using this DAX:
is missing = --var missingCrust = IF( LEN( TRIM('Table'[ Crust] ) ) = 0 , "Crust," ) var missingCrust = IF( ISBLANK( 'Table'[ Crust] ) || LEN( TRIM('Table'[ Crust] ) ) = 0 , "Crust," )var missingSauce = IF( ISBLANK( 'Table'[ Sauce] ) || LEN( TRIM( 'Table'[ Sauce] ) ) = 0 , "Sauce," ) var missingCheese = IF( ISBLANK( 'Table'[ Cheese] ) || LEN( TRIM( 'Table'[ Cheese] ) ) = 0 , "Cheese," ) var missingTopping = IF( ISBLANK( 'Table'[ Topping] ) || LEN( TRIM( 'Table'[ Topping] ) ) = 0 , "Topping," ) var thisismissing = missingCrust & missingSauce & missingCheese & missingTopping var lastcharacter = RIGHT( thisismissing , 1 ) return IF( lastcharacter = "," , LEFT( thisismissing , LEN( thisismissing ) - 1 ) , thisismissing )The DAX looks more complicated than what might be really needed, but this is due to the spaces that have been added to the single columns from the data you provided, and I wasn't that motivated to clean the data 🙂
Nevertheless, here is a screenshot from a table visual, of course, you can just use the columns OrderID and "is missing":
Hopefully, this provides what you are looking for.
Regards,
Tom
- FowmySuper User
zbeg
You can use a table visual and keep only the order ID, and add this measure:Still Needs = VAR __ItemsFound = { ("Crust",MAX(Pizza[Crust])), ("Sauce",MAX(Pizza[Sauce])), ("Cheese",MAX(Pizza[Cheese])), ("Topping",MAX(Pizza[Topping])) } VAR __ItemsNeeded = CONCATENATEX( __ItemsFound, IF( [Value2] = BLANK(), [Value1] & "," ),BLANK() ) VAR __LENGTH = LEN(__ItemsNeeded)-1 RETURN IF( __LENGTH <> -1 , LEFT(__ItemsNeeded, __LENGTH) )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂