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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
CastroRibeiro
Helper I
Helper I

Filter two different values based on a column

I have a customer who has a delivery time that is different from the rest of the other customers, for this customer the time is <= 9 while for the rest the time is <= 8

How do I only count customer times for UNBCES when the delivery time is <=9 at the same time I filter the data of other customers which is <=8

 

My attempt was first to count the values of the UNBCES client and then take these values and filter again the other clients that have a shorter time, which is <=8, but it didn't work

 

UNBCES_CLIENT count

 

UNBCES_CLIENT = 
var UNBCES = 
    CALCULATE(
       COUNTROWS(fcriticalDemands),
            FILTER(
                fcriticalDemands,
                fcriticalDemands[CLIENT]="UN-BC" &&
                fcriticalDemands[deliveryTime]<=9))

 return UNBCES    

 

 

UNBCES_CLIENT and trying to count the rest of the clients

 

CLIENTS = 
var CLIENT= 
    CALCULATE(
       Leadtime[UNBCES_CLIENT],
            FILTER(
                fcriticalDemands,
                fcriticalDemands[deliveryTime]<=8))

return CLIENT

 

 

2 REPLIES 2
VahidDM
Super User
Super User

Hi @CastroRibeiro 

 

can you share a sample data and let us know how do you like to show the result?

 

BTW, if you want to count with different values, try this:

 

Count_CLIENT = 
Vat _Time = if(fcriticalDemands[CLIENT]="UN-BC",9,8)
var _Count= 
    CALCULATE(
       COUNTROWS(fcriticalDemands),
            FILTER(
                fcriticalDemands,
                fcriticalDemands[deliveryTime]<=_Time))

 return 
 _Count

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

I want to show something like this, but I have to calculate it differently for the UN-BC client and for the others it's the same thing

 

The other colors refer to other time calculations, the green value is what we think of the ideal time, which for the un-bc client is <=9

 

GRAFH.PNG

 

LD.PNG

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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