Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi
I have 2 measures : Turnover and Last Year Turnover
I want to have a measure in dax
Distinct customer who have turnover this year but not last year
Disctinct customer who have turnover last year but not this year
I try
Thank you very much, this clearly shows me the results for this year and last year.
How can I modify it so that it works for each year and its previous year? whether it is dynamic?
thanks in advance
Hi, @vespa
in @Jihwan_Kim code modify like below
var _currentyear= selectedvalue(datetablename[yearcolumn])
to be more dynamic is it possible to use something to get current period et same period last year ?
Hi, I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
please check the below picture and the attached pbix file if it suits your requirement.
EXCEPT function (DAX) - DAX | Microsoft Learn
Only this year customers count: =
VAR _currentyear =
YEAR ( TODAY () )
VAR _lastyear = _currentyear - 1
VAR _thisyearlist =
CALCULATETABLE (
SUMMARIZE ( Sales, Customer[Customer] ),
'Calendar'[Year] = _currentyear
)
VAR _prevyearlist =
CALCULATETABLE (
SUMMARIZE ( Sales, Customer[Customer] ),
'Calendar'[Year] = _lastyear
)
VAR _onlythisyearlist =
EXCEPT ( _thisyearlist, _prevyearlist )
RETURN
CALCULATE ( COUNTROWS ( Customer ), _onlythisyearlist )Only previous year customers count: =
VAR _currentyear =
YEAR ( TODAY () )
VAR _lastyear = _currentyear - 1
VAR _thisyearlist =
CALCULATETABLE (
SUMMARIZE ( Sales, Customer[Customer] ),
'Calendar'[Year] = _currentyear
)
VAR _prevyearlist =
CALCULATETABLE (
SUMMARIZE ( Sales, Customer[Customer] ),
'Calendar'[Year] = _lastyear
)
VAR _onlypreviousyearlist =
EXCEPT ( _prevyearlist, _thisyearlist )
RETURN
CALCULATE ( COUNTROWS ( Customer ), _onlypreviousyearlist )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 35 | |
| 34 | |
| 28 |
| User | Count |
|---|---|
| 136 | |
| 99 | |
| 73 | |
| 66 | |
| 65 |