Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I have the following transactions table:
CCost | Account | Date | Budget | Actual | Description |
1 | 1 | 20190101 | 100 | 10 | Gas |
1 | 1 | 20190102 | 100 | 50 | Salary |
1 | 1 | 20190201 | 200 | 50 | Gas |
1 | 1 | 20190202 | 200 | 150 | Salary |
1 | 1 | 20190203 | 200 | 10 | Gas |
CCenter is the Cost Center, Account is the bank account, date is the date of the transaction, budget is the budget for that Account, for that Cost Cost, for that specific year-month. The Actual column is the value of the transaction and Description is the description of the transcation. So for example, in January 2019 the company spent 60 dollars on salary and gas. And the budget was 100 - not 200. And in February 2019, 210 dollars was spent and the budget was 200.
I want to create a matrix, tha display the right budget values, but it sums all the values - January 200, and Februaray 600 dollars.
How can I do that, using Dax or Power Query and preferably , not creating a new table.
Try this dax measure
totalbudget =
Var budgetbymaxdate = CALCULATE(sum(Table1[Budget]),FILTER(Table1,Table1[Date]=ENDOFMONTH(Table1[Date])))
Return
budgetbymaxdate
It worked, but sorry, I thought it was not relevant, but I am using a date table to filter the sales table.
CalendarTable Sales
Date <-----------------------------> Date
Month CCenter
Day Account
Year Budget
Actual
Description
So using the measure that you said does not works when I use slicers with CalendarTable's columns.
@Anonymous
Try this DAX
TotalbudgetbyMonth =
var maxvalue = SUMX(SUMMARIZE(DateTable,DateTable[Month],"amt",MIN(Table1[Budget])),[amt])
return
maxvalue
@avknishokpbi, almost working.
When I use a drill down, it shows the smallest value intead of the sum.
Hi @Anonymous,
Did you try in the case of the budget the average function, because it seems the budget amount is repeated...
Let us know
Ninter
Hi @Interkoubess, using the average only works if the the matrix is on the last drill level. Look the example:
The right budget is 300 not 160. How can I do that?
Hi @Anonymous,
Based on my test, I could not understand why the average value in '2019' shoud be 300? It seems that the total value in 2019 should be 800 and the average should be 800/5(date) and equal to 160. Could you please offer me more information about what you want to calculate?
Regards,
Daniel He
Hi @v-danhe-msft,
I understood why the average is 160, but I do not want it. Looking on the sample dataset, the values of the budget get repeated for every sale. For example:
Dataset:
One sale on the day:
1 | 1 | 20190101 | 100 | 10 | Gas |
Two sales on the day:
1 | 1 | 20190101 | 100 | 10 | Gas |
1 | 1 | 20190101 | 100 | 50 | Gas |
Four sales on the day:
1 | 1 | 20190101 | 100 | 10 | Gas |
1 | 1 | 20190101 | 100 | 50 | Gas |
1 | 1 | 20190201 | 100 | 50 | Gas |
1 | 1 | 20190201 | 100 | 150 | Gas |
For the Cost Center 1 - Account 1 - 2019 January, independent of the number of the sales, the budget for Gas is 100 dollars. So I want to display 100 dollars on matrix using drill down.
Hi @Anonymous,
How the budget is populating?
Could you please check this column formula based on the first date ( I don't know how the budget is populating),
Budget_modified = IF(DAY('Table 0'[Date])=1,'Table 0'[Budget],0)
In summary I make the budget equals to zero but the first day of the month.
Let me know if it does not work.....
Ninter
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
78 | |
52 | |
39 | |
35 |
User | Count |
---|---|
94 | |
79 | |
51 | |
47 | |
47 |