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 Supply | 0 | Blank |
Product With Supply and no Demand or 0 Zero Demand | > 0 | Blank |
Product With no Supply and has Demand | < 0 | 0 |
Product with Supply and Demand | 0 | 1 |
Product with Supply and Demand | <0 | 0 |
Product with Supply and Demand | >0 | 1 |
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.
CountProduct:=
VAR RowCount =COUNTROWS (
FILTER (
SUMMARIZE(FILTER('SupplyTable',[Demand]>0 && [Supply]>0), 'SupplyTable'[ProductID] ,'SupplyTable'[SegmentID]),
(
IF(
(
(ISBLANK([Demand])=TRUE
||[Demand]=0
)
&&
(ISBLANK([Supply])=TRUE
||[Supply]=0)
)
||
(
(ISBLANK([Demand])=TRUE
||[Demand]=0)
&&
[Supply]>0
)
,-1
,
IF
(
(ISBLANK([Demand])=FALSE
||[Demand]>0
)
&&
(ISBLANK([Supply])=TRUE
||[Supply]=0)
,[Demand]
,[Net Supply]
)
)>= 0
))
)
RETURN
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
Hi @gardas_swathi ,
Have trouble to follow, please share some sample data so that we could test formula.
Best Regards,
Jay
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.
User | Count |
---|---|
94 | |
82 | |
42 | |
32 | |
28 |
User | Count |
---|---|
130 | |
95 | |
84 | |
46 | |
40 |