Forum Discussion
Convert column to measure
- 8 years ago
If you want to aggregate the risk, wrap the function in an iterator
Given the Table is called Test, the function I provided gives the total durable score (not ratio) based on a Durability field which has a Text value of either "Durable" or "Normal" as per the question.
Durability Risk = SUMX(Test,IF(Test[Durability]="Durable",0,1))
- 8 years ago
After adding a 1:1 relationship between Supplier Namers and Suppliers, I can use
Durability Risk = SUM(Suppliers[Durability Risk])
I don't understand why I can't add a number column that is available in Supplier Names to other measures I created, though. It seems convoluted to have to reference the value that way.
- 8 years ago
Hi jiwhite,
=> When I try to use IF, the Durability column is not selectable.
In your scenario you are using measure. Right? You should know that when using a measure, it is unable to call table column directly. The columns should be wrapped with aggregate functions. If you use your formula in a calculated column. It will work fine without any issue.
Please refer to following calculated column:
Then you want to count the Durability when Durability = 'Normal'. Right? To achieve it will measure, you can refer to following expression:
SUM Durability Risk = CALCULATE ( COUNT ( Suppliers[Durability Risk] ), FILTER ( Suppliers, Suppliers[Durability Risk] = "Normal" ) )Thanks,
Xi Jin.
Hi jiwhite,
=> When I try to use IF, the Durability column is not selectable.
In your scenario you are using measure. Right? You should know that when using a measure, it is unable to call table column directly. The columns should be wrapped with aggregate functions. If you use your formula in a calculated column. It will work fine without any issue.
Please refer to following calculated column:
Then you want to count the Durability when Durability = 'Normal'. Right? To achieve it will measure, you can refer to following expression:
SUM Durability Risk =
CALCULATE (
COUNT ( Suppliers[Durability Risk] ),
FILTER ( Suppliers, Suppliers[Durability Risk] = "Normal" )
)Thanks,
Xi Jin.
Thanks for the example. That would work great if the scale only had two items. I simplified for the purposes of asking the question. I'll keep that in mind for the future.