Forum Discussion
count distinct by month
- 9 years ago
I’m not sure about your exact table. I write some DAX formulas for following sample table (There is another Calendar table which has relationship with this fact table). Please take a look at the result to see if it is you desired.
Year = YEAR ( Table1[Date] )
Month = MONTH ( Table1[Date] )
ExistClient = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALL ( Table1 ), Table1[Year] = EARLIER ( Table1[Year] ) && Table1[Month] < EARLIER ( Table1[Month] ) && Table1[Client] = EARLIER ( Table1[Client] ) ) )DistinctCount = CALCULATE ( DISTINCTCOUNT ( Table1[Client] ), Table1[ExistClient] = BLANK () )
Percent = CALCULATE ( DISTINCTCOUNT ( Table1[Client] ), FILTER ( ALL ( Table1 ), Table1[Month] <= MAX ( Table1[Month] ) && Table1[Year] = MAX ( Table1[Year] ) && Table1[ExistClient] = BLANK () ) ) / CALCULATE ( DISTINCTCOUNT ( Table1[Client] ), FILTER ( ALL ( Table1 ), Table1[ExistClient] = BLANK () ) )There are also some documents about Pareto Chart in PowerBI. Hope they are helpful to you.
http://powerbi.tips/2016/10/pareto-charting/
http://www.dutchdatadude.com/power-bi-pro-tip-pareto-analysis-with-dax/
Best Regards,
Herbert
I’m not sure about your exact table. I write some DAX formulas for following sample table (There is another Calendar table which has relationship with this fact table). Please take a look at the result to see if it is you desired.
Year = YEAR ( Table1[Date] )
Month = MONTH ( Table1[Date] )
ExistClient =
CALCULATE (
COUNTROWS ( Table1 ),
FILTER (
ALL ( Table1 ),
Table1[Year] = EARLIER ( Table1[Year] )
&& Table1[Month] < EARLIER ( Table1[Month] )
&& Table1[Client] = EARLIER ( Table1[Client] )
)
)
DistinctCount = CALCULATE ( DISTINCTCOUNT ( Table1[Client] ), Table1[ExistClient] = BLANK () )
Percent =
CALCULATE (
DISTINCTCOUNT ( Table1[Client] ),
FILTER (
ALL ( Table1 ),
Table1[Month] <= MAX ( Table1[Month] )
&& Table1[Year] = MAX ( Table1[Year] )
&& Table1[ExistClient] = BLANK ()
)
)
/ CALCULATE (
DISTINCTCOUNT ( Table1[Client] ),
FILTER ( ALL ( Table1 ), Table1[ExistClient] = BLANK () )
)
There are also some documents about Pareto Chart in PowerBI. Hope they are helpful to you.
http://powerbi.tips/2016/10/pareto-charting/
http://www.dutchdatadude.com/power-bi-pro-tip-pareto-analysis-with-dax/
Best Regards,
Herbert
Hi Herbert
You are awesome!!
Just tested your suggested solution and it worked perfectly in my dataset.
The pareto chart I was trying to build now looks great!
Thanks again
Regards
Melissa