Forum Discussion
Need help with DAX
- 2 years ago
SagarJagga Hi!
First, you need to have a distinct separate table for "Name", you can calculate the table with this formula:
NameTable = DISTINCT('Table'[Name])
Then, create a two measures:SelectedSegment = VAR selitem = SELECTEDVALUE(NameTable[Name])RETURNCALCULATE(MAX('Table'[Segment]),'Table'[Name] = selitem,ALL())FilteredSales =VAR SegmentToFilter = [SelectedSegment]RETURNCALCULATE(SUM('Table'[Sales]),'Table'[Segment] = SegmentToFilter)and put in the matrix "Metro" and this last measure. You'll obtain:If it's ok, please accept this answear as a solution.
BBF
- Anonymous2 years ago
Hi SagarJagga ,
Your solution is great, BeaBF . Here I have another idea in mind, and I would like to share it for reference.
The steps are as follows:
- Create a new table:
- Create a measure, the formula is as follows:
Measure = VAR _my_se = VALUES('Table 2'[Table_Segment]) RETURN CONCATENATEX(FILTER('Table','Table'[Segment] IN _my_se),1)- Filtering operations on measure:
- The result is shown in the figure with a slicer ,Table and Table2.
If you have any other questions please feel free to contact me.
Best Regards,
Zhu
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
SagarJagga Hi!
First, you need to have a distinct separate table for "Name", you can calculate the table with this formula:
Then, create a two measures:
If it's ok, please accept this answear as a solution.
BBF
can you please attach your pbix file
- BeaBF2 years ago
Super User
SagarJagga Here the link:
https://drive.google.com/file/d/1Rp1ZT4XBQIVEO-6VnrzWFurSSayMPkK4/view?usp=drivesdk
BBF
- SagarJagga2 years agoFrequent Visitor
Not sure why it is not working for me. i have tried by passing hard code value for Segment as well
- BeaBF2 years ago
Super User
SagarJagga in the filter you have to use Name of Tablename, see my pbix