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 All
I have an matrix table that looks like the below.
The amount in Account 1 Sub Account B needs to subtracted away from Sub account A. The ledger system listed sub account b for reference only but it is already included in sub account a (i have no control over the data output).
Sub Account A should equal 400,000 in Jan and 520,000 in Feb. The totals for account 1 in Jan should therefore be 400k and 520k for Feb.
I cannot for the life of me work out how to do this with a measure.
I've saved a sample PBIX file to gdrive. Any pointers would be great.
Solved! Go to Solution.
Hi, @User7664
Please check the below picture and the sample pbix file's link down below.
The measure is in the sample pbix file.
Account1 fix =
VAR subaccounta =
CALCULATE (
SUM ( 'Sample'[ Amount ] ),
'Sample'[Sub Account] = "Sub Account A"
)
VAR subaccountb =
CALCULATE (
SUM ( 'Sample'[ Amount ] ),
'Sample'[Sub Account] = "Sub Account B"
)
VAR account2 =
CALCULATE ( SUM ( 'Sample'[ Amount ] ), 'Sample'[Account] = "Account 2" )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Sample'[Sub Account] ) = "Sub Account A", subaccounta - subaccountb,
SELECTEDVALUE ( 'Sample'[Sub Account] ) = "Sub Account B", BLANK (),
SELECTEDVALUE ( 'Sample'[Account] ) = "Account 1", subaccounta - subaccountb,
NOT ISFILTERED ( 'Sample'[Account] ),
account2 + subaccounta - subaccountb,
SUM ( 'Sample'[ Amount ] )
)
https://www.dropbox.com/s/nynsd9omaxzmu0r/Sample%202.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @User7664
Please check the below picture and the sample pbix file's link down below.
The measure is in the sample pbix file.
Account1 fix =
VAR subaccounta =
CALCULATE (
SUM ( 'Sample'[ Amount ] ),
'Sample'[Sub Account] = "Sub Account A"
)
VAR subaccountb =
CALCULATE (
SUM ( 'Sample'[ Amount ] ),
'Sample'[Sub Account] = "Sub Account B"
)
VAR account2 =
CALCULATE ( SUM ( 'Sample'[ Amount ] ), 'Sample'[Account] = "Account 2" )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Sample'[Sub Account] ) = "Sub Account A", subaccounta - subaccountb,
SELECTEDVALUE ( 'Sample'[Sub Account] ) = "Sub Account B", BLANK (),
SELECTEDVALUE ( 'Sample'[Account] ) = "Account 1", subaccounta - subaccountb,
NOT ISFILTERED ( 'Sample'[Account] ),
account2 + subaccounta - subaccountb,
SUM ( 'Sample'[ Amount ] )
)
https://www.dropbox.com/s/nynsd9omaxzmu0r/Sample%202.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Should this be done in the query editor? I think a measure is the best way?
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |