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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
jonnyA
Responsive Resident
Responsive Resident

Creating a measure with a filter

I have a Field that is counting Visits where I can filter specific Visits using "Visit is 1" or "Visit is 0".

 

How can I create measure that has the filter "Visit is 1" built in?  This way I wont have to use a filter.

 

Thank you!

1 ACCEPTED SOLUTION
jonnyA
Responsive Resident
Responsive Resident

Thank you for your time and effort!

 

Here is the formula for visits ...

CALCULATE(

DISTINCTCOUNT(Dataset[Voucher_Number]),

[IsVisit] = 1)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @jonnyA ,

 

You could use filter function.

https://docs.microsoft.com/en-us/dax/filter-functions-dax 

Measure = calculate(countrows('table'),filter(allselected('table'),[Visits] = "Visit is 1"))

I'd like to suggest you to create a independent slicer.

https://docs.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-slicers 

slicer = distinct('table'[visits])

Then modify the measure as bleow:

Measure = calculate(countrows('table'),filter(allselected('table'),[Visits] = selectedvalue('slicer'[visits])))

So that you don't have to create multiple measures for different [visits].

 

Best Regards,

Jay

MFelix
Super User
Super User

Hi @jonnyA ,

 

You can create the following measure:

 

Visit 1 = CALCULATE(COUNT(Table[Visit]), Table[Visit] = "Visit is 1")

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



jonnyA
Responsive Resident
Responsive Resident

Thank you for your time and effort!

 

Here is the formula for visits ...

CALCULATE(

DISTINCTCOUNT(Dataset[Voucher_Number]),

[IsVisit] = 1)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors