'Create Power BI Measure based on the value in the column of the current table for each row and selected values from the slicer
I need to create a Measure in the table based on a calculation with the value in the another column and selected values from slicer.
Table "MyTab:"
| DataType | Product | Amount |
|---|---|---|
| Type1 | Product 1 | 100 |
| Type1 | Product 2 | 200 |
| Type1 | Product 3 | 300 |
| Type2 | Product 1 | 50 |
| Type2 | Product 2 | 60 |
First, "MyMeasure" should use the value for the "DataType" column, so for each row I need to use value from that column. I'm trying to use this code, but it doesn`t work properly:
MyMeasure = maxx('MyTab', 'MyTab'[DataType])
Also, I tried this:
MyMeasure = CALCULATE(min(
'MyTad'[DataType]),
FILTER ('MyTad', 'MyTad'[DataType]="Type1"))
So, I need to get this table:
| DataType | Product | Amount | MyMeasure |
|---|---|---|---|
| Type1 | Product 1 | 100 | Type1 |
| Type1 | Product 2 | 200 | Type1 |
| Type1 | Product 3 | 300 | Type1 |
| Type2 | Product 1 | 50 | Type2 |
| Type2 | Product 2 | 60 | Type2 |
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
