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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

Elegant function for filtering using more than two critera

Hey hey fine folk of PBI!

Trying to create a reusable measure of customer sales per region, the issue is that the database does not have the regions setup.

My need is something like this

Count all sales for customers in asia.

Asia_sales = CALCULATE(COUNT(RawDataTable[Total Sales]);
FILTER(RawDataTable;(RawDataTable[Company location] = "Indonesia North" && (RawDataTable[Company location] = "Indonesia South") && (RawDataTable[Company location] = "Indonesia east") 

Above was just an example to get the gist of what I'm trying to accomplish. Any tips for how to do this in the most "elegant" way?

In the end, I will try to SUM the data by region with all the data of the companies included. Thanks!
3 REPLIES 3
RickPowerBI
Helper I
Helper I

Hi @CauseAndEffect,

 

Try using FIND or SEARCH, You would get something like this:

(Bare in mind, i'm not an expert so this may not work at all but it may give you an idea of how to fix your problem)

Asia_sales = 
CALCULATE ( COUNT ( RawDataTable),
FILTER ('RawDataTable',
NOT (
ISBLANK (
FIND ("Indonesia North", [Company location], , BLANK ())))
|| NOT (
ISBLANK (
FIND ("Indonesia South", [Company location], , BLANK ())))
|| NOT (
ISBLANK (
FIND ("Indonesia east", [Company location], , BLANK ()))),
[Total Sales])

 

Solved it, just created a Calculate using the correct syntax

New Measure ->

 

00_Countryfilter = CALCULATE(COUNT(RawDataTable[Sales]);
RawDataTable[Store Location] = "Indonesia East" ||
RawDataTable[Store Location] = "Indonesia West" ||
RawDataTable[Store Location] = "Indonesia South" ||
RawDataTable[Store Location] = "Japan South" ||
RawDataTable[Store Location] = "Japan South IKU")

Optimally i need to use an unlimied amount of filters since our customer location column has over 2k unique locations.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.