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
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
v-jayw-msft
Community Support
Community Support

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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
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.