Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I have a list of bank balances showing a snapshot of each account's balance on a given date.
E.g.
Date | Account | Balance | OD This Month |
01/08/2016 | 1 | £10 | FALSE |
01/08/2016 | 2 | -£5 | FALSE |
15/08/2016 | 2 | £15 | FALSE |
01/09/2016 | 1 | £20 | FALSE |
01/09/2016 | 2 | -£30 | TRUE |
01/09/2016 | 3 | £40 | FALSE |
15/09/2016 | 1 | -£10 | TRUE |
15/09/2016 | 2 | £45 | FALSE |
15/09/2016 | 3 | £30 | FALSE |
I have added a calculated column to indicate whether an account has been overdrawn this month or not, using the following formula:
OD This Month =
IF(
AND(
[Balance] < 0,
MONTH( [Date] ) = MONTH( MAX( [Date] ) )
),
TRUE(),
FALSE()
)
When put into a matrix, this looks like this (created in excel, but same in pbi):
The problem is, I want to see the balances on the days that the account wasn't overdrawn as well - where the gaps are (just for those accounts that have been overdrawn at some point during this month).
The way I can think to do it is to create a formula that returns TRUE next to all balances (including positive ones) from an account that has been overdrawn at some point this month.
Could anyone help with creating this formula or is there another solution?
Thanks!
Solved! Go to Solution.
Hi @bullius
Here is an example of how it could be done, just using a measure rather than any calculated columns:
Account Balance = SUM ( Balance[Balance] ) Account Balance for months where overdrawn = CALCULATE ( [Account Balance], FILTER ( ADDCOLUMNS ( SUMMARIZE ( Balance, Balance[Account], 'Calendar'[End of Month] ), "MinBalance", CALCULATE ( MIN ( Balance[Balance] ), ALLEXCEPT ( 'Calendar', 'Calendar'[End of Month] ) ) ), [MinBalance] < 0 ) )or
Account Balance for months where overdrawn v2 =
SUMX (
VALUES ( Balance[Account] ),
IF (
CALCULATE (
MIN ( Balance[Balance] ),
ALL ( 'Calendar' ),
VALUES ( 'Calendar'[End of Month] )
)
< 0,
[Account Balance]
)
)
Sample pbix file here:
https://www.dropbox.com/s/ku2cuioh5blyoh9/Account%20Overdrawn.pbix?dl=1
I'm sure there are other ways of implementing similar logic.
Owen 🙂
Hi @bullius
Here is an example of how it could be done, just using a measure rather than any calculated columns:
Account Balance = SUM ( Balance[Balance] ) Account Balance for months where overdrawn = CALCULATE ( [Account Balance], FILTER ( ADDCOLUMNS ( SUMMARIZE ( Balance, Balance[Account], 'Calendar'[End of Month] ), "MinBalance", CALCULATE ( MIN ( Balance[Balance] ), ALLEXCEPT ( 'Calendar', 'Calendar'[End of Month] ) ) ), [MinBalance] < 0 ) )or
Account Balance for months where overdrawn v2 =
SUMX (
VALUES ( Balance[Account] ),
IF (
CALCULATE (
MIN ( Balance[Balance] ),
ALL ( 'Calendar' ),
VALUES ( 'Calendar'[End of Month] )
)
< 0,
[Account Balance]
)
)
Sample pbix file here:
https://www.dropbox.com/s/ku2cuioh5blyoh9/Account%20Overdrawn.pbix?dl=1
I'm sure there are other ways of implementing similar logic.
Owen 🙂
Hi @bullius,
I am not sure what specific values you want to show in your matrix visual, could you please describe more details?
If you want display Matrix visual as follows, you don’t need to use OD This Month slicer, just choose 1 and 2 using visual filter to filter your matrix.
Thanks,
Lydia Zhang
Thanks @v-yuezhe-msft
The above data is just an example. Your solution would work for this data, but the solution for the actual data needs to be more dynamic.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |