Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello PBI Community,
I'm working on report to calculate expenses status based in Departmnet and Type as in screenshot below. Due to remaining calculation after each sepnding and budget type I need to add remaining in Matrix visula, however the sum of remaining is worng it should be Sum of Mini values per each expense type in TOTAL without effect the remaining column rows values as in last column. Attached the excel samplefile, please support:
Sample excel link: Link
Thanks,
Solved! Go to Solution.
hi @Power2BI
This is happening because previously you had different label names under Title > Expense type but now you have same label name and multiple rows under Expense Type.
1. Please use this measure, I have changed how Index value is derived.
2. Please correct Index, In Power Query Column should be sorted by Title > Expense type > Label (all ascending order), then add Index column.
= Table.Sort(#"Changed Type",{{"Title", Order.Ascending}, {"ExpenseType", Order.Ascending}, {"Label", Order.Ascending}})
Remaining Measure =
hi @Power2BI
If you need Calculated column, please see solution from @Anonymous
If you need a measure, please see below.
You need to add Index in Power Query. Then use this measure.
@talespin Yes this working well on Expense type level, however in expense level keep showing wrong value when I moved the new measure as screen shot below and attached file (NEW PowerBI sample link 😞
hi @Power2BI
This is happening because previously you had different label names under Title > Expense type but now you have same label name and multiple rows under Expense Type.
1. Please use this measure, I have changed how Index value is derived.
2. Please correct Index, In Power Query Column should be sorted by Title > Expense type > Label (all ascending order), then add Index column.
= Table.Sort(#"Changed Type",{{"Title", Order.Ascending}, {"ExpenseType", Order.Ascending}, {"Label", Order.Ascending}})
Remaining Measure =
Hi @Power2BI ,
You can create a calculated column to calculate the minimum remaining value.
Min Remaining =
VAR _mini = MINX(FILTER(ALL('Table'), 'Table'[ExpenseType] = EARLIER('Table'[ExpenseType]) && 'Table'[Budget] = 0), 'Table'[Remaining])
RETURN
IF('Table'[Remaining] = _mini,_mini,BLANK())
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Power2BI ,
@talespin provided a good method of applying measure to solve the problem. I have a method of applying calculated column to solve the problem. I hope it can be helpful to you.
1. Create a new index column in the power query editor for subsequent calculations.
2. Create a calculated column to get the remaining value.
remain =
VAR _sum_spent = CALCULATE(SUM(Sheet2[Spent]),FILTER(ALL('Sheet2'),'Sheet2'[Department] = EARLIER('Sheet2'[Department]) && 'Sheet2'[Type] = EARLIER('Sheet2 '[Type]) && 'Sheet2'[Index] <= EARLIER('Sheet2'[Index])))
VAR _sum_budget = CALCULATE(SUM(Sheet2[Budget]),FILTER(ALL('Sheet2'),'Sheet2'[Department] = EARLIER('Sheet2'[Department]) && 'Sheet2'[Type] = EARLIER('Sheet2 '[Type])))
RETURN
IF('Sheet2'[Spent] = BLANK(),BLANK(),_sum_budget - _sum_spent)
3. Create a calculated column to obtain the minimum value of the remaining values.
mini =
VAR _mini = CALCULATE(MIN('Sheet2'[remain]),FILTER(ALL('Sheet2'),'Sheet2'[Department] = EARLIER(Sheet2[Department]) && 'Sheet2'[Type] = EARLIER(Sheet2[ Type])))
RETURN
IF('Sheet2'[remain] = _mini,_mini,BLANK())
The final result is shown in the figure below, and more details can be found in the attachment.
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @Anonymous for proposing this solution. Unfortuntly didnt work for me as I tried to use the same Measure in my report but didnt give me correct remainig number.
Here attached another sampe file which might be helpful to know more about my issue (PowerBI Sample data link).
Thanks again, looking forwared to hear back from you ..
AMD
hi @Power2BI
Somthing like this?
Thanks @talespin for proposing this solution. Unfortuntly didnt work for me as I tried to use the same Measure in my report but didnt give me correct remainig number.
Here attached another sampe file which might be helpful to know more about my issue (PowerBI Sample data link).
Thanks again, looking forwared to hear back from you ..
AMD
Your data is missing an index column. Power BI has no idea how to sort it, or what "Remaining" refers to.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |