The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I tried to write the following:
Solved! Go to Solution.
the issue is from the nature of variable in DAX. Once defined, a variable is stored as a constant. So whatever filter you add in expressions like
CALCULATE(CY, SAMEPERIODLASTYEAR('Calendar'[Date]))
it simply return CY, a constant defined before.
So CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Calendar'[Date])) is the right approach.
Dear Sudden Clarity,
You could use same period last year as a Variable - see my example where as Variable is using same periodlastyear
and with date change,
the issue is from the nature of variable in DAX. Once defined, a variable is stored as a constant. So whatever filter you add in expressions like
CALCULATE(CY, SAMEPERIODLASTYEAR('Calendar'[Date]))
it simply return CY, a constant defined before.
So CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Calendar'[Date])) is the right approach.
User | Count |
---|---|
26 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |