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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
IF
Post Prodigy
Post Prodigy

multiple filters

Hi,

Maybe this is a simple question but would like to know the best practice.

I have the following table and I want to filter with the following and get the sum.

- I have a slice for ID. Based on the slicer selection i want to have total.

- Filters are: Output is 3, Type is 99 and period can be either 3, 6 or 12.

- the table is:

IDOutputTypePeriodValue
A399314
A399613
A3991216
Axc1233
A499#23
A3f#22
A3v1232
B399314
B399623
B3991216
Bxc1230
B499#23
B3f#26
B3v1221

 

Measure3 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Output]="3"), FILTER('Table','Table'[Type]="99"), FILTER('Table', ('Table'[Period]="3" || 'Table'[Period]="12" || 'Table'[Period]= "6")))
or
Measure2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Output]="3" && 'Table'[Type]="99" && 'Table'[Period] in {"3", "12", "6"}))
 
which one is best to use? They both give the correct answer.
 
Best
4 ACCEPTED SOLUTIONS
JPScotland
Helper I
Helper I

I think the second formula reads better and probably minismises system overheads. 

View solution in original post

lkalawski
Resident Rockstar
Resident Rockstar

Hi @IF ,

 

The second option is better because you don't load the table into the Filter function each time - you do it once.

Is this measure the only one with such many conditions? If not and you will create more similar measures then in my opinion it is better to use slicers to filter the data.



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

Sujit_Thakur
Solution Sage
Solution Sage

Dear @IF  ,
use measure 2 it will work out faster .

Give kudos to motiavte .
if this helped accept as solution
Regards ,
Sujit

View solution in original post

amitchandak
Super User
Super User

@IF , the second one is better. We should avoid the use of "OR" as far as possible. OR can slow down on big data

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@IF , the second one is better. We should avoid the use of "OR" as far as possible. OR can slow down on big data

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Sujit_Thakur
Solution Sage
Solution Sage

Dear @IF  ,
use measure 2 it will work out faster .

Give kudos to motiavte .
if this helped accept as solution
Regards ,
Sujit

lkalawski
Resident Rockstar
Resident Rockstar

Hi @IF ,

 

The second option is better because you don't load the table into the Filter function each time - you do it once.

Is this measure the only one with such many conditions? If not and you will create more similar measures then in my opinion it is better to use slicers to filter the data.



_______________
If I helped, please accept the solution and give kudos! 😀

JPScotland
Helper I
Helper I

I think the second formula reads better and probably minismises system overheads. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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