Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gduobaite
Helper III
Helper III

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
Fowmy
Super User
Super User

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


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 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy you are today's hero. 🙂

Thank you.

@Fowmy , awesome! Thank you!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.