Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I need to create a table or matrix that breaks the data into 4 columns: this month, last month, average of last 6 months, and avg of last 12 months.
What is the best way to go about this? I tried grouping the data, but the groups can't overlap (ie 4/20/22 would need to be included in last month, last 6 months, and last 12 months. I also tried this formula
Solved! Go to Solution.
Hi:
If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.
If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING>NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.
Let]s say you have a measure for Total Charges:
Total Charges = SUM('Charge Data'[Total Charges])
Then you use this pattern with DATEADD function
Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))
Charges last 6 months = CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))
Last 12 Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))
I hope this helps:
Date Table cose next:
Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )
Hi:
If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.
If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING>NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.
Let]s say you have a measure for Total Charges:
Total Charges = SUM('Charge Data'[Total Charges])
Then you use this pattern with DATEADD function
Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))
Charges last 6 months = CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))
Last 12 Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))
I hope this helps:
Date Table cose next:
Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
13 | |
11 | |
8 |