Forum Discussion
Create a table with a different measure for each row
- 9 years ago
Hi,
With "If" statements? (if category = category 1; measure 1; if cat= cat 2.... etc)
- 9 years ago
Hi Anonymous,
In addition, you should also be able to use SWITCH function in this scenario. The formula below is for your reference. :smileyhappy:
AMOUNT = IF ( HASONEVALUE ( 'Table1'[CATEGORY] ), SWITCH ( VALUES ( 'Table1'[CATEGORY] ), "Category 1", [measure1], "Category 2", [measure2], "Category 3", [measure3], "Category 4", [measure4], "Category 5", [measure5], "Category 6", [measure6], 0 ) )Regards
Hi Anonymous,
In addition, you should also be able to use SWITCH function in this scenario. The formula below is for your reference. :smileyhappy:
AMOUNT =
IF (
HASONEVALUE ( 'Table1'[CATEGORY] ),
SWITCH (
VALUES ( 'Table1'[CATEGORY] ),
"Category 1", [measure1],
"Category 2", [measure2],
"Category 3", [measure3],
"Category 4", [measure4],
"Category 5", [measure5],
"Category 6", [measure6],
0
)
)
Regards
Hi v-ljerr-msft,
If I understand correctly, the amount formula you are doing is creating a column, but my question is how to create the table with the Category column.
Thank you and best regards.
- v-ljerr-msft9 years agoMicrosoft Employee
Hi Anonymous,
Where is the Category column from? Is it a column of one of your table in your mode?
If that is the case, you can firstly use the the formula below to create a measure.
Measure1 = IF ( HASONEVALUE ( 'CatagoryTable'[Catagory] ), SWITCH ( VALUES ( 'CatagoryTable'[Catagory] ), "Category 1", [measure1], "Category 2", [measure2], "Category 3", [measure3], "Category 4", [measure4], "Category 5", [measure5], "Category 6", [measure6], 0 ) )Then you should be able to use the formula below to create the table with the Category column. :smileyhappy:
Table = SUMMARIZE ( 'CatagoryTable', 'CatagoryTable'[Catagory], "Amount", [Measure1] )
Regards
- pbiforum1236 years agoPost Patron
Can you please attach the sample PBI which I can refer this?
I am trying to create the table as in below post. Is that possible with the above code? Please guide me..
- pbiforum1236 years agoPost Patron
When i am trying to create the table as you have mentioned I am getting below error. Please help...
"The function SUM cannot work with values of type String."
- Red2174 years agoHelper III
Thank you,
you REALLY helped me