Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
i have this dax function to calculate page views same period from last year
Hi @Anonymous ,
I agree with @Anonymous, it is good practice to organize your data model with a dedicated date table and create a relationship with your other table.
Then you use a CALCULATE() function with a SAMEPERIODLASTYEAR() function
It would look something like that
Measure from last year = CALCULATE ( [MyMeasure], SAMEPERIODLASTYEAR ( calendarTbl[Date] ) )
For more info on SAMEPERIODLASTYEAR() check this page https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Let us know if you need more help in refining your model
this does not work in my situation. actually i've already tried this function. that's why i have to use a long dax code. i basically defind these variables and it works 80%. it's just when i select the date slicer, the goal did not change as expected. it became blank. and when i change another slicer, it works. i would love to go with my current solution because it's so close.
thank you so much!
Hi @Anonymous
Can you provide some sample data?
this is how it looks like: when i did not select anything in 'View Date', it shows 82679 in indicator which is all data from 2018 and 19 and (31300 which is 2018 data).
but when i select 2019, the perfect situation is indicator 51379 and goal should be 31300, but it shows blank. i really think it's very close to what i want. may just be some slight change. i created two measures for indicator and goal, and they are in my first threshold.
Hi @Anonymous
See the illustration below if that can be of help
If that still doesn't work for you, you could send me the file with some sample data at david@fumastra.com
I'd start by getting a dedicated date table and relate that your fact table. Then you can leverage the time intelligence functions, or at least make writing the dax easier and increase performance.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |