Forum Discussion
Anonymous
5 years agoNot applicable
Dynamic filter values
Hello everyone, I have an issue to correctly count the distinct products within dynamic filter options. This is my simple data model which consists of only one table. In the first column ...
- 5 years ago
Anonymous , Assume first date filter is working
M2 =
var _date = FIRSTDATE(Table[Creation Date])
var _value = CALCULATE(DISTINCTCOUNT(Table[Product Number]),filter( Table[Creation Date]=_date && ((Table[Country] = "Denmark" && Table[Sales Channel] = "DK Trade") || (Table[Country] = "France" && Table[Sales Channel] = "FR Retail"))
))
RETURN IF(ISBLANK(_value),0,_value)
Fowmy
5 years agoSuper User
Anonymous
Try this way:
M2 =
var _country = SELECTEDVALUE(Table[Country])
var _date = FIRSTDATE(Table[Creation Date])
var _value = CALCULATE(DISTINCTCOUNT(Table[Product Number]), Table[Creation Date]=_date,
IF ( _country = "Denmark", FILTER( Table, [Sales Channel] = "DK Trade"),
IF ( _country = "France"), FILTER( Table, [Sales Channel] = "FR Retail")))
RETURN IF(ISBLANK(_value),0,_value)________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply š