Showing results for 
Search instead for 
Did you mean: 

Need Distinct count of Product ID based on Filter Criteria

Hi ,


I need help in figuring out the solution for a measure in Analysis Tabular Cube. CountProduct is the measure I am trying to create. I need to find count of products based on the below criteria ( scenarions listed in the table below) and the count should be visible at any grain when sliced. Also Grand Total should be just the total count of products for any given selection


Scenario NetSupply[Existing measure : Supply- Demand ]CountProduct
No Demand No Supply0Blank
Product With Supply and no Demand or 0 Zero Demand> 0Blank
Product With no Supply and has Demand< 00
Product with Supply and Demand01
Product with Supply and Demand<00
Product with Supply and Demand>01


Demand, Supply & Net Supply are existing measures in Cube. if a product is has 2 segment ID's and has demand and supply , I need to double count when looking at the higher grain which is why i used Summarize function to group by productid and segmentid. Below measure is showing just 0 even when demand and supply are available. 


SUMMARIZE(FILTER('SupplyTable',[Demand]>0 && [Supply]>0), 'SupplyTable'[ProductID] ,'SupplyTable'[SegmentID]),
,[Net Supply]

)>= 0

IF (ISBLANK(RowCount)=TRUE &&[Net Supply]<0,0,RowCount)


I got solutions from @amitchandak  and @Greg_Deckler  before. Hope you can help even this time or even anyone in this forum

Community Support
Community Support

Hi @gardas_swathi ,


Have trouble to follow, please share some sample data so that we could test formula.


Best Regards,


Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors