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.
Hey guys,
I want to calculate an average of monthly values of GAV for a year. But instead of starting at January, start at December of the previous year and include all months of year (and for ongoing year all months to date) + december last year. It was so simple in excel, and I can't figure out a solution on PBI.
Here is a simple example of what I am trying to do:
https://www.dropbox.com/s/m8m312om0tfffxg/Example6.xlsx?dl=0
Any ideas how to set up the time inteligence for this?
Solved! Go to Solution.
Hi @Anonymous
Do you have Year column in your table, or you use a Date table? I am using the same to show you one way
Ave =
VAR CurY=MAX(factTable[Year])
RETURN
AVERAGEX(FILTER(ALL('factTable'),factTable[Data]>=DATE(CurY-1,12,1)&&factTable[Data]<=DATE(CurY,12,31)),[GAV])
Hi @Anonymous
Yes, your case is different from the simple Excel sample, so modified a little bit
Average GAV =
VAR CurY=MAX(Dates[Year])
VAR T1 = CALCULATETABLE(ADDCOLUMNS(ALL(Dates[EndOfMonth]),"TEST",[GAV]),ALL(Dates[Year]))
RETURN
AVERAGEX(FILTER(T1,[EndOfMonth]>=DATE(CurY-1,12,1)&&[EndOfMonth]<=DATE(CurY,12,31)),[TEST])
Hi @Anonymous
Do you have Year column in your table, or you use a Date table? I am using the same to show you one way
Ave =
VAR CurY=MAX(factTable[Year])
RETURN
AVERAGEX(FILTER(ALL('factTable'),factTable[Data]>=DATE(CurY-1,12,1)&&factTable[Data]<=DATE(CurY,12,31)),[GAV])
Hey, thank you a lot it does seem to work with the excel data, but my PBI model has a few extra details and for some reason it does not include the december of last year it seams. I am attaching an example file:
https://www.dropbox.com/s/a006u6lay2mnsvl/Example7.pbix?dl=0
In this case the expected value for 2021 would be 27176766,83.
Hi @Anonymous
Yes, your case is different from the simple Excel sample, so modified a little bit
Average GAV =
VAR CurY=MAX(Dates[Year])
VAR T1 = CALCULATETABLE(ADDCOLUMNS(ALL(Dates[EndOfMonth]),"TEST",[GAV]),ALL(Dates[Year]))
RETURN
AVERAGEX(FILTER(T1,[EndOfMonth]>=DATE(CurY-1,12,1)&&[EndOfMonth]<=DATE(CurY,12,31)),[TEST])
Worked like a charm, thank you 🙂
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 |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
108 | |
90 | |
64 |