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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
NoordenNL076
Regular Visitor

Count with exceptions

Hello,

 

I'm trying to determine the count of a storage type. The storage type is based on the maximum volume a product has within a certain period. However, before linking the storage type there are two exeptions: Dangerous Goods, who automatically go to "Hazmat" storage types and certain "Horizontal" products which go to a "Flowrack". These latest are dedicated to the flowrack, but then are dedicated to a subtype based on its maximum volume. 

 

To keep it short: I need a IF function that first analyses whether the product is an exception or not. If its a horizontal product, it need to go to a flowrack, but the subtype is yet to be determined by its volume. After the exceptions, the remaining products need to be allocated to a subtype based on its volume and the subtypes' capacity. The capacity changes if I use different values for my parameters, which are slicers that move. The total volume of a product then increases or decreases. If it is below a certain limit, the allocated storage type changes.

 

This last part, the remaining products, are easy to allocate:

 

NoordenNL076_0-1653500088183.png

 

I've made a column in my facts table to identify whether it's a Dangerous Good or a Horizontal product using "0" if not and "1" if two, where "00" = normal product, 10 = Horizontal product (vapro) and 01 = DG. Here are the results:

 

NoordenNL076_1-1653500189049.png

 

My guess is Power BI has to count how many times "00", "01" and "10" is occurs in the table using an IF function, but Power BI can't do IF over a column.

 

Does someone have a solution two this problem? Hopefully my rather confusing explanation is to be understood.

 

THANK YOU

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @NoordenNL076 

not sure what exactly is your requirement. However, there are many ways to "countif" using dax. For exsmple

COUNTROWS ( FILTER ( TableName, TableName[ColumnName] = "Value" ) )

or

SUMX. (

TableName,

IF ( TableName[ColumnName] = "Value", 1 )

)

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @NoordenNL076 ,

 

Whether the advice given by @tamerj1  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

tamerj1
Community Champion
Community Champion

Hi @NoordenNL076 

not sure what exactly is your requirement. However, there are many ways to "countif" using dax. For exsmple

COUNTROWS ( FILTER ( TableName, TableName[ColumnName] = "Value" ) )

or

SUMX. (

TableName,

IF ( TableName[ColumnName] = "Value", 1 )

)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.