Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
How can I put inside a filter?
I have a few different Event Names and I need to do Clicks' calculations for all of them seperately.
DAX I have now:
Clicks =
var_table=SUMMARIZE('table1', 'table1'[Doctor], 'table1'[Date time], "name", DISTINCTCOUNT('table1'[Doctor]))
return
SUMX(_table,[name])
What I tried but nothing happened:
Clicks =
var_table=SUMMARIZE('table1', 'table1'[Doctor], 'table1'[Date time], "name", CALCULATE( DISTINCTCOUNT('table1'[Doctor]), 'table1'[Event Name) = "drug_prices_opened"))
return
SUMX(_table,[name])
Event Names I need to implement seperately into formula:
Solved! Go to Solution.
@gduobaite
Please try your measure like this:
Clicks =
var _name = SELECTEDVALUE('table1'[Event Name])
var _table =
SUMMARIZE(
'table1',
'table1'[Doctor],
'table1'[Date time],
"name", CALCULATE( DISTINCTCOUNT('table1'[Doctor]), 'table1'[Event Name] = _name)
)
return
SUMX(_table,[name])
________________________
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 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@gduobaite
Please try your measure like this:
Clicks =
var _name = SELECTEDVALUE('table1'[Event Name])
var _table =
SUMMARIZE(
'table1',
'table1'[Doctor],
'table1'[Date time],
"name", CALCULATE( DISTINCTCOUNT('table1'[Doctor]), 'table1'[Event Name] = _name)
)
return
SUMX(_table,[name])
________________________
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 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Dear @Fowmy ,
can you please show how can I add a second filter into this formula?
Second filter should be from the same table1: 'table1'[Search Result] = "Not found"
Clicks = var _name = SELECTEDVALUE('table1'[Event Name]) var _table = SUMMARIZE( 'table1', 'table1'[Doctor], 'table1'[Date time], "name", CALCULATE( DISTINCTCOUNT('table1'[Doctor]), 'table1'[Event Name] = _name) ) return SUMX(_table,[name])
@gduobaite
Please check this:
Clicks =
var _name = SELECTEDVALUE('table1'[Event Name])
var _table =
SUMMARIZE(
'table1',
'table1'[Doctor],
'table1'[Date time],
"name", CALCULATE( DISTINCTCOUNT('table1'[Doctor]), 'table1'[Event Name] = _name,
'table1'[Search Result] = "Not found")
)
return
SUMX(_table,[name])
________________________
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 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |