Forum Discussion
dax
I want to show distinct count of customers for the last 3 months in the current month (eg. count of july, aug, sept in the month of sept) similarly count of aug, sept, oct in oct .......i want to display this data in a line and bar chart where in x axis i have month and in y line axis i have distinct count and i want the dax to be dynamic.
Hi, Anonymous
Anonymous
try below code it helpjust adjust your table and column name
Measure = var a= MAX('Table'[Month])-2 var b =CALCULATE(DISTINCTCOUNT('Table'[Customer_Code]),'Table'[Month]>=a && 'Table'[Month]<=MAX('Table'[Month])) return bas your data check output using above code
10 Replies
- Uzi2019Community Champion
Hi Anonymous
Please try to create following column and measure:
Calculated column ( Date3)= DATEADD('Table'[Date],-3,MONTH)
This will do the -3 month calculation.
Measure=CALCULATE(DisctinctCount(Table[Clicks]),DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date]),min(table[Date3])))This will give you distinct count between 3 month period.
If my post helps please give kudos and accept it as a solution!
Thanks- AnonymousNot applicable
i want to show in this(left one) in the 9th month i want to show distinctcount of 7,8,9 combined then in 8th i want to display 6,7,8 combined
- Uzi2019Community Champion
Hi Anonymous
If possible just paste the sample data from excel to here.would be better for us to work on your data.
just whatever data is needed to create that chart.