Forum Discussion
no123
2 years agoRegular Visitor
HELP WITH DAX CODE
Hi everyone im new to PowerBI. Here is my request from clients. A Fact table contains keywords such as healthy toothpaste, christmas healthy toothpaste, yellow toothpaste,... etc. And each keyword...
- 2 years ago
Hi no123
Something like this?
I used a measure in the Filters on this visual section:
Contains word =var curr = SELECTEDVALUE('Key'[Keywords]) --Current row in the tablevar countWords = COUNTROWS(values('root'[single root])) --words ticked in slicervar filtwords =COUNTROWS(FILTER('root' --filter slicer table,CONTAINSSTRING(curr,[single root]) --check if current word found in row)) --count how many words matched the rowRETURNif(filtwords = countWords --if the number of words in row match words ticked,1 --return 1,0 --others)
SamWiseOwl
Super User
2 years agoHi no123
Something like this?
I used a measure in the Filters on this visual section:
Contains word =
var curr = SELECTEDVALUE('Key'[Keywords]) --Current row in the table
var countWords = COUNTROWS(values('root'[single root])) --words ticked in slicer
var filtwords =
COUNTROWS(
FILTER(
'root' --filter slicer table
,CONTAINSSTRING(curr,[single root]) --check if current word found in row
)) --count how many words matched the row
RETURN
if(
filtwords = countWords --if the number of words in row match words ticked
,1 --return 1
,0 --others
)
no123
2 years agoRegular Visitor
thanks, it works