Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi All,
looking for help to write DAX formula/measure.
Consider data in table below, there is a Fixed Value (Limit) for each Bank (col B).
Bank may spend money throughout the year.
I need to write a formula which will SUBTRACT sum of "Used Amount" by category "Bank Name" FROM fixed value (from col B) - it should give me one value, showing what amount is left to be used - then I add it to the bar chart.
X axis - Bank name
Y axis - col B and Sum of col D and amount left to be used (calculated from DAX formula) - each bank will have 3 columns in visual.
I tried to do that on my own, but because this fixed value from col B is duplicated all over the table, then this is a problem for me to cover this exception in the formula.
I know it would be better to keep this fixed value from col B in separate table like:
Bank A - 100mln
Bank B - 500mln
Bank C - 250mln
but this is the data model with which I have to work and I can not change that 😞
Solved! Go to Solution.
Hi @Patryk_PL_92
Before jumping to much more complex formulas, would you please try the following
_SumSpentCash = SUM ( Table1[Used Amount] )
_AvgTotalAvailableFunds = AVERAGE ( Table1[Available amount for this year] )
_SubCashLeftToBeUsed = [_AvgTotalAvailableFunds] - [_SumSpentCash]
Please share the dax formula that you have use? Is it a measure or a calculated column?
What is needed is a measure - single value per Bank Name.
Subtraction between:
[available funds in col B] - [sum of spent cash in col D]
Currently there are no calculated columns in a table, these are raw data from data source.
Formula I used:
1st measure (to calculate how much have we spent in total per Bank):
_SumSpentCash = CALCULATE(SUM(Table1[Used Amount]), Table1[Bank Name])
2nd measure (to get one amount of available funds per bank. There must be a better way to get that fixed value, but I do not have an idea how to... 😞 😞
_AvgTotalAvailableFunds = AVERAGEX(KEEPFILTERS(VALUES(Table1[Bank Name])), CALCULATE(COUNTA(Table1[Available amount for this year]))
3rd measure (final one - it should show how much cash can we still spend, not to go over the fixed limit):
_SubCashLeftToBeUsed = CALCULATE([_AvgAvailableFunds] - [_SumSpentCash])
Hi @Patryk_PL_92
Before jumping to much more complex formulas, would you please try the following
_SumSpentCash = SUM ( Table1[Used Amount] )
_AvgTotalAvailableFunds = AVERAGE ( Table1[Available amount for this year] )
_SubCashLeftToBeUsed = [_AvgTotalAvailableFunds] - [_SumSpentCash]
Hi @tamerj1
After your post I just found my stupid mistake in formulas
1st measure should not have the filter parameter
2nd measure can look as simple as yours or:
_AvgTotalAvailableFunds = AVERAGEX(KEEPFILTERS(VALUES(Table1[Bank Name])), CALCULATE(SUM(Table1[Available amount for this year]) / COUNTA(Table1[Available amount for this year]))
Anyway, it works well now
thanks for help 😉
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |