Forum Discussion
PBIsteven77
1 year agoRegular Visitor
Count *text string* match between 2 tables
I have looked through the suggested solutions, asked AI sources, and talked to peers, alas, i am still stumped. I have a spreadsheet where the user has applied multi select, where -from a drop do...
- 1 year ago
Hi PBIsteven77
Try these measures:
Count of Instance = CALCULATE ( COUNTROWS ( 'Description' ), FILTER ( 'Description', CONTAINSSTRING ( 'Description'[Elixhauser Variable Description (CD)], SELECTEDVALUE ( Variable[Variable] ) ) ) )Count of Instance2 = SUMX ( ADDCOLUMNS ( SUMMARIZE ( Variable, Variable[Variable] ), "@instance", CALCULATE ( COUNTROWS ( 'Description' ), FILTER ( 'Description', CONTAINSSTRING ( 'Description'[Elixhauser Variable Description (CD)], [Variable] ) ) ) ), [@instance] )The first one returns the total matching rows from Description. The second one will return the total of individual rows.
- 1 year ago
Thank you for these. They were also giving me the same result. So i disconnected the relationship with the 2 tables, and the issue went away. Bone-headed mistake on my part. Thank you for hte quick response!
danextian
1 year agoSuper User
Hi PBIsteven77
Try these measures:
Count of Instance =
CALCULATE (
COUNTROWS ( 'Description' ),
FILTER (
'Description',
CONTAINSSTRING (
'Description'[Elixhauser Variable Description (CD)],
SELECTEDVALUE ( Variable[Variable] )
)
)
)
Count of Instance2 =
SUMX (
ADDCOLUMNS (
SUMMARIZE ( Variable, Variable[Variable] ),
"@instance",
CALCULATE (
COUNTROWS ( 'Description' ),
FILTER (
'Description',
CONTAINSSTRING (
'Description'[Elixhauser Variable Description (CD)],
[Variable]
)
)
)
),
[@instance]
)
The first one returns the total matching rows from Description. The second one will return the total of individual rows.
- PBIsteven771 year agoRegular Visitor
Thank you for these. They were also giving me the same result. So i disconnected the relationship with the 2 tables, and the issue went away. Bone-headed mistake on my part. Thank you for hte quick response!