I have a matrix in PowerBI that should be a rolling 12 month view of sales, and I need it to be cumulative. This is what I have so far:
Matrix
The Cumulative Sum row has values of 10 for Oct 2022 and Feb 2023, so I would like it to show 0s until Oct 2022, 10s until Feb 2023, and 20s thereafter.
The values look like this in the dataset:
Dataset
EDIT: The dataset is filtered in the image, there will be multiple rows and values for each month in the unfiltered dataset.
Related
I need to form a trended chart of last 12 months depending on the slicer selection from the user, for one of the MAT calculation. MAT calculation looks like below, here I am using Calendar2 table to find out MAT sum according to month selection, suppose if I have selected Nov 2022 in month slicer(of Calendar table) then it will give me Dec 2021 to Nov 2022 in Calendar2 table. Connection between Calendar and Calendar2 table is inactive ->
var a=MAX(Calendar[Date])
var preious_dates=DATESINPERIOD(Calendar2[Date],a,-12,MONTH)
var Ours=CALCULATE(SUM(Market_Share_Brands[value]),Market_Share_Brands[manufacturer]="Ours",Market_Share_Brands[channels]="D - Commerce",REMOVEFILTERS('Calendar'),
KEEPFILTERS(preious_dates),USERELATIONSHIP('Calendar'[Date],Calendar2[Date]))
var Others=CALCULATE(SUM(Market_Share_Brands[Value]),Market_Share_Brands[Manufacturer]<>"Ours",Market_Share_Brands[Channels]="D - Commerce",REMOVEFILTERS('Calendar'),
KEEPFILTERS(preious_dates),USERELATIONSHIP('Calendar'[Date],Calendar2[Date]))
return DIVIDE(Ours,(Others+Ours))
So this thing is working fine if I want to show particular month's MAT value, but if I need to show trended chart for last 12 months then it filters out the month that is being selected and not the last 12 months.
What should I do to get last 12 month's MAT numbers in trended chart?
Have an easy one here but can't figure it out
Month
Numerator
Denominator
Jan
4
10
Jan
2
9
Feb
8
1
Feb
4
15
etc.
So the chart has month along the X-axis and then I would want the weight average for each column.
So Jan the average would be 6/19=32%, Feb would be 12/16=75%, etc. etc. --looking for a measure to capture the y-axis data
Create a Calulated Table from the your 'Table':
Calulated Table =
SUMMARIZE(
'Table',
'Table'[Month],
"Weight Average",
DIVIDE(
SUM('Table'[Numerator]),
SUM('Table'[Denominator])
)
)
The result will look like this:
The questions relates to DAX/PowerBI.
I've been trying to calculate a total for previous month for columns that contain only specific criteria (project name). My table looks more or less like this and is named Project Costs:
Project Name
Date
Cost in Month
Month
Year
X
01/01/2021
2.000,00
1
2021
Y
01/01/2021
1.500,00
1
2021
Z
01/01/2021
4.800,00
1
2021
X
01/02/2021
3.000,00
2
2021
Y
01/02/2021
3.500,00
2
2021
Z
01/02/2021
2.200,00
2
2021
X
01/03/2021
1.000,00
3
2021
Y
01/03/2021
6.000,00
3
2021
Z
01/03/2021
2.000,00
3
2021
I have a slicer in my report that allows me to select from all my projects.
I want to be able to visualize different financial data relating only to the project currently selected with the slicer. I managed set up calculations for cost to date, labour to date etc., however, I am struggling to find a way to calculate a rolling previous month cost relating only to the selected project, that would be susceptible to the slicer in the visuals.
I've tried the following:
Prev Month Cost Rolling =
SUMX(RELATEDTABLE('Project Costs'), 'Project Costs'[Cost in Month],
DATEADD('Project Costs'[Date], -1, MONTH))
And it does not work as it says the max. argument count for SUMX is 2.
I have tried solutions suggested here too, but they don't work either (I might be doing th wrong): Power BI Rolling Total Previous Month DAX
Expected result:
Once the report is filtered to a project Z, in March I would expect to see in card visuals:
Cost to date: 9.000,00
Cost in previous month: 2,200.
When filtered for X in March it would want it to be as follows:
Cost to date: 6.000,00
Cost in previous month: 3.000,00
I want to calculate the entire previous month, not month to date.
I would appreciate any advise on how to tackle it!
Thanks,
J
Have a look at these measures:
Total Project Cost = CALCULATE([Cost], FILTER(ALL(Projects[Date]), Projects[Date] <= MAX(Projects[Date]))) - this shows all historical costs up to the selected date.
Cost = SUM(Projects[Cost in Month]) - can be used for costs in current month, for instance
Cost previous month = CALCULATE([Cost], PREVIOUSMONTH('Projects'[Date]))
I have date dimension table and sales fact table.
Created a chart visual with date week on x axis and values as sum of salesamt.
In the filter pane added relative filter to the date. In the last 4 calendar weeks.
I have a measure that shows LASTDATE(DateTable[Date]) also on the report.
The last date is showing as 6 Feb 2021 (Saturday)
Same value when I select the latest week on x axis.
However when I choose any prior week on x axis, then the last date value is Sunday 31 Jan 2021.
Why does the current week last date show as 6th Jan 2021 (saturday) instead of 7th Jan 2021 (sunday)?
Currently, calendar week is defined Sunday to Saturday when it comes to filtering using relative dates. You can work around it by introducing additional column (basically date - 1 day) and set your relative filter on that.
I have 3 measures:
1) total_trx = SUM(mytable[trx])
2) trx_prev_month = CALCULATE([total_trx], DATEADD(calendar[date], -1,MONTH))
3) monthly_var = DIVIDE([total_trx],[trx_prev_month])-1
If I add a waterfall viz, x-axis with month, it gives me the % of monthly variation and a TOTAL bar at the end that sums all the variations.
I need to reproduce that total number in order to show a KPI as in "so far, we've increased ...%", changing when using a date slicer.
Seems like sum(monthly_var) is not allowed.
Any ideas?
Thank you very much.
Edit1: sample with date filter = Last 4 months
Jul 100 0%
Aug 110 10%
Sep 90 -20%
Oct 80 -10%
Total: -20% <- need a dax to calculate this number and show just -20%
Then if I change the filter to, for example LAST 6 MONTHS, I need to calculate it up to May
In order to get the desired result we will use an intermediate table in our query that will summarize the results by months:
use this code and replace calendar[Year Month] with your Year month column :
SUMX(
SUMMARIZECOLUMNS(calendar[Year Month],"Monthly_int_var",[monthly_var]),
[Monthly_int_var]
)