cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Inside filter

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:

gduobaite_0-1601489789556.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Inside filter

@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 🙂

YouTube  LinkedIn

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: Inside filter

@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 🙂

YouTube  LinkedIn

View solution in original post

Highlighted
Helper II
Helper II

Re: Inside filter

@Fowmy , awesome! Thank you!

Highlighted
Helper II
Helper II

Re: Inside filter

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])

 

 

Highlighted
Community Champion
Community Champion

Re: Inside filter

@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 🙂

YouTube  LinkedIn

Highlighted
Helper II
Helper II

Re: Inside filter

@Fowmy you are today's hero. 🙂

Thank you.

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors