Forum Discussion
Net New Count per Batch
Hi,
I am new to PowerBI, and I am trying to find the net new count of brands per batch in my data. Please find the below sample data.
I need to count the Net new brands in each batch, comparing the previous batches. I would also get more batches like batch4, batch 5 in future.
Desired output:
I am unsure on how to bring in the "not in the previous batch" condition to compute for every batch. Can anyone help me with this please?
Thanks in Advance,
Anu
Anonymous this is possible with the following measure
Measure = VAR _batch = MAX ( 'Table'[_batch] ) VAR _count = COUNTROWS ( EXCEPT ( VALUES ( 'Table'[Brand] ), SUMMARIZE ( FILTER ( ALL ( 'Table' ), 'Table'[_batch] < _batch ), 'Table'[Brand] ) ) ) RETURN _countYou need a quanitifable batch# column
7 Replies
- Jihwan_KimSuper User
Hi,
Please check the below picture and the attached pbix file.
One of many ways to solve this is to have a Batch_dimenstion table with the index number column that can identify which batches are the previous ones.
Brand count not in the previous batches: =VAR currentbatchindex =MAX ( 'Batch'[Index] )VAR currentbatchbrand =VALUES ( Data[Brand] )VAR previousbatchesbrand =CALCULATETABLE (VALUES ( Data[Brand] ),FILTER ( ALL ( 'Batch' ), 'Batch'[Index] < currentbatchindex ))VAR onlycurrentbatchbrand =EXCEPT ( currentbatchbrand, previousbatchesbrand )RETURNIF ( HASONEVALUE ( 'Batch'[Batch] ), COUNTROWS ( onlycurrentbatchbrand ) ) - smpa01Community Champion
Anonymous can you please provide the sample data in table format and not just picture please?
- AnonymousNot applicable
Here is the sample table:
Brand Batch Nike Batch1 Nike Batch2 Game Batch1 Silk Batch2 Came Batch2 Adidas Batch1 Adidas Batch2 Game Batch3 Came Batch3 hike Batch3 dell Batch3 Joy Batch3 - smpa01Community Champion
Anonymous Thanks and what is the desired output based on this?