Forum Discussion
Need help on creating calculated column
- 10 months ago
Hi Krushnab85 ,
Please wrap your table filter inside a Distinct function, this way you will get the desired output.Required Output 2 = VAR MetricGroup = 'Table'[Metric Name] RETURN CONCATENATEX ( DISTINCT ( SELECTCOLUMNS ( FILTER ( 'Table', 'Table'[Metric Name] = MetricGroup ), "Product", 'Table'[Product], "Sample", 'Table'[Sample] ) ), [Product] & " = " & [Sample], ", " )Uploading the sample .pbix file for reference.
I hope this information helps. Please do let us know if you have any further queries.
Thank you
Hi Krushnab85
1. Create the Calculated Column.We want a column that shows all Product = Sample values for each Metric Name group.
- In Data view, go to Modeling >> New column.
- Enter this DAX:
Required Output =
VAR MetricGroup = 'Table'[Metric Name]
RETURN
CONCATENATEX (
FILTER (
'Table',
'Table'[Metric Name] = MetricGroup
),
'Table'[Product] & " = " & 'Table'[Sample],
", "
)
2. Outcome:
It worked for what i have provided but in real world secanario i need unique product names across the metric name groups -
for example -
| CC | Rectangle | 60 | Rectangle = 60 |
| CC | Rectangle | 60 | Rectangle = 60 |
- v-nmadadi-msft10 months agoCommunity Support
Hi Krushnab85 ,
Please wrap your table filter inside a Distinct function, this way you will get the desired output.Required Output 2 = VAR MetricGroup = 'Table'[Metric Name] RETURN CONCATENATEX ( DISTINCT ( SELECTCOLUMNS ( FILTER ( 'Table', 'Table'[Metric Name] = MetricGroup ), "Product", 'Table'[Product], "Sample", 'Table'[Sample] ) ), [Product] & " = " & [Sample], ", " )Uploading the sample .pbix file for reference.
I hope this information helps. Please do let us know if you have any further queries.
Thank you