Forum Discussion
Aggregating Distinct Count measure and Aggregating IF measure
- 7 years ago
Hi Kevin_Gitonga,
Try these two measures, please.
Measure = SUMX ( SUMMARIZE ( 'table', 'table'[ProductCode], 'table'[CustomerCode], "Billing", DISTINCTCOUNT ( 'table'[InvNumber] ) ), [Billing] )
Total Golden Point = SUMX ( SUMMARIZE ( 'table', 'table'[ProductCode], 'table'[CustomerCode], "Golden Point", IF ( DISTINCTCOUNT ( 'table'[InvNumber] ) >= 1, 1, 0 ) ), [Billing] )
Best Regards,
- 7 years ago
Hi,
Try this measure
Billing = if(HASONEVALUE(Data[ProductCode]),DISTINCTCOUNT(Data[InvNumber]),SUMX(SUMMARIZE(VALUES(Data[ProductCode]),[ProductCode],"ABCD",DISTINCTCOUNT(Data[InvNumber])),[ABCD]))
Hope this helps.
- 7 years ago
Hi,
The Golden Points measure can be revised to:
Golden Point = SUMX(SUMMARIZE(GENERATE(VALUES(Sales[CustomerCode]),VALUES(Sales[ProductCode])),[CustomerCode],[ProductCode],"ABCD",if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0)),[ABCD])
Hope this helps.
hi Ashish_Mathur were you able to have a glance of the linked pbix file I'm using
Hi,
Try this measure for Golden Points
Golden Point = if(HASONEVALUE(Sales[CustomerCode]),if(HASONEVALUE(Sales[ProductCode]),if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0),SUMX(SUMMARIZE(VALUES(Sales[ProductCode]),[ProductCode],"ABCD",if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0)),[ABCD])),SUMX(SUMMARIZE(VALUES(Sales[CustomerCode]),[CustomerCode],"ABCD",if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0)),[ABCD]))
Hope this helps.
- Kevin_Gitonga7 years ago
Helper I
Hi, Ashish_Mathur, Thanks for your assistance so far. I tried this and it works well for the row total, however the total of the row total column(Bottom left) is not givign the right answer e.g here it gives 320 while in the real sense it should be 657 when you compute the totals.
- Ashish_Mathur7 years ago
Super User
Hi,
I'll need to see the PBI file.
- Kevin_Gitonga7 years ago
Helper I
Ashish_Mathurhere's the link
https://www.dropbox.com/s/m9rlnrqu9afrial/Sales%20dashboard%20test-%20Copy.pbix?dl=0
- Ashish_Mathur7 years ago
Super User
Hi,
The Golden Points measure can be revised to:
Golden Point = SUMX(SUMMARIZE(GENERATE(VALUES(Sales[CustomerCode]),VALUES(Sales[ProductCode])),[CustomerCode],[ProductCode],"ABCD",if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0)),[ABCD])
Hope this helps.
- Kevin_Gitonga7 years ago
Helper I
Thanks, this worked well - Ashish_Mathur7 years ago
Super User
You are welcome.
- Kevin_Gitonga6 years ago
Helper I
Ashish_MathurI have a query on this, am I able to filter the products used in this formula using the values in another table.
Golden Point = SUMX(SUMMARIZE(GENERATE(VALUES(Sales[CustomerCode]),VALUES(Sales[ProductCode])),[CustomerCode],[ProductCode],"ABCD",if(DISTINCTCOUNT(Sales[InvNumber])>=1,1,0)),[ABCD])The products to filter in the formula are based on this table where different periods have diffrent products used in the Golden point formula above.
- Ashish_Mathur6 years ago
Super User
Hi,
I am not clear with your question. Please share a simple dataset, explain the business context and show the expected result.