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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

conditional count based on a the outcome of a sum

good day,
 
I'm trying to find the following:
below is a measure which sums up number of pallets. So far so good, this is working as intended. 
 
NumberOfPallets = CALCULATE(SUM(T_SalesData[Nr of Pallets Sold]),
FILTER(T_SalesData,
T_SalesData[DirectDelivery]="0"&&
T_SalesData[Delivery terms]<>"FCA"))
 
What I need to do now is to count the occasions where the outcome of above measure is for example lower than 3, or between 2 values.
 
Any suggestions how to go about this? I can't seem to figure it out. 
 
thanks
 
 
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this pattern

 

Measure =
COUNTROWS (
    FILTER ( VALUES ( TableName[OccassionColumnName] ), [NumberOfPallets] < 3 )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this pattern

 

Measure =
COUNTROWS (
    FILTER ( VALUES ( TableName[OccassionColumnName] ), [NumberOfPallets] < 3 )
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad 

 

thanks again for this and please disregard my other response. the one question I do still have on this topic is how I would add another filter(s), based on a column (field) in the underlying table. So, combining this filter based on the outcome of a measure and one or more filters on field(s) in my table. 

my trialling and errorring has not worked for me sofar. 

thanks

Anonymous
Not applicable

thanks @Zubair_Muhammad for the suggestion and I'd say this would be perfect, yet countrows would overstate my outcome as there could be multiple rows per my "key". I.e. I'm grouping the number of records (product codes per delivery) per day. I'm looking for the count of the sum of this grouped sum. Using countrows would end up showing each individual row (product code) per delivery which would match the "<3" condition no? 

 

I hope I make myself clear? 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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