Forum Discussion
Help Filtering
- 7 years ago
You can create two measures to achieve amount in 2018 and 2019 seprately:
Customers Amount 2018 = CALCULATE(DISTINCTCOUNT('Table'[Customer]), FILTER('Table', 'Table'[Purchase Date] = 2018)) Customers Amount 2019 = CALCULATE(DISTINCTCOUNT('Table'[Customer]), FILTER('Table', 'Table'[Purchase Date] = 2019))Then you can create a temp table via click "New Table" using DAX below:
Customers Amount in 2018 not in 2019 = VAR Table_2018 = SUMMARIZE(FILTER(ALL('Table'), 'Table'[Purchase Date] = 2018), 'Table'[Customer]) VAR Table_2019 = SUMMARIZE(FILTER(ALL('Table'), 'Table'[Purchase Date] = 2019), 'Table'[Customer]) RETURN ADDCOLUMNS(EXCEPT(Table_2018, Table_2019), "Date", 2018)Finanly, create a measure to count customers who purchased in 2018 but not purchased in 2019 in the new temp table:
Customers Amount in 2018 not in 2019 = COUNTROWS('Customers Amount in 2018 not in 2019')You may also refer to pbix attached.
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can create two measures to achieve amount in 2018 and 2019 seprately:
Customers Amount 2018 = CALCULATE(DISTINCTCOUNT('Table'[Customer]), FILTER('Table', 'Table'[Purchase Date] = 2018))
Customers Amount 2019 = CALCULATE(DISTINCTCOUNT('Table'[Customer]), FILTER('Table', 'Table'[Purchase Date] = 2019))
Then you can create a temp table via click "New Table" using DAX below:
Customers Amount in 2018 not in 2019 =
VAR Table_2018 = SUMMARIZE(FILTER(ALL('Table'), 'Table'[Purchase Date] = 2018), 'Table'[Customer])
VAR Table_2019 = SUMMARIZE(FILTER(ALL('Table'), 'Table'[Purchase Date] = 2019), 'Table'[Customer])
RETURN
ADDCOLUMNS(EXCEPT(Table_2018, Table_2019), "Date", 2018)
Finanly, create a measure to count customers who purchased in 2018 but not purchased in 2019 in the new temp table:
Customers Amount in 2018 not in 2019 = COUNTROWS('Customers Amount in 2018 not in 2019')
You may also refer to pbix attached.
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks!