Forum Discussion
populate multiple columns
Hi Gambrinus,
If I understand your requirement correctly that you want to reference the var fruit when you create another calculated column?
If it is, it seems that is not supported in Power BI currently.
If you don't want to create the var fruit for each time when you create the calculated column, you could create the fruit as a calculated column, then you could reference it when you create another calculated column.
Best Regards,
Cherry
Thanks for the reply Cherry.
What I want, is once I've detemined the type of food in ColumnJ, to populate another column (ColumnX) with a literal for the type of food.
In my two-food-type example, either Var Fruit or Var Vegetable will be populated. I'd like to accomplish this:
If(trim(Fruit)<>"",[ColumnX]="This is a Fruit",If(trim(Vegetable)<>"",[ColumnX]="This is a Vegetable","Unknown"))
So if the Var Fruit has a value, then ColumnX will contain the literal test, otherwise, if Var Vegetable has a value, ColumnX will have different literal text, otherwise ColumnX will have "Unknown"
Thank you.
- v-piga-msft8 years agoResident Rockstar
Hi Gambrinus,
Try this formula below.
Column 2 = VAR fruit = LOOKUPVALUE ( 'table'[Fruits], 'table'[Text Data], 'table'[Text Data] ) VAR vege = LOOKUPVALUE ( 'table'[Vegetables], 'table'[Text Data], 'table'[Text Data] ) RETURN IF ( vege <> "", "This is a vegetable", IF ( fruit <> "", "this is a fruit", "Unknown" ) )Here is the output.
For more details, you could have a reference of the attachment.
Best Regards,
Cherry
- v-piga-msft8 years agoResident Rockstar
Hi Gambrinus,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regards,
Cherry