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.
I have two tables. One table has debits and credits and the other table has analytic codes.
I need to subtract the debit - credits but only using certain analytic codes from another table.
For example i have a GL account of 30010 that when i subtract the debits and credits it gives me a total but for all of the analytic codes in another table. I want to be able to choose (filter) what analytic codes should be included in the calculation.
Solved! Go to Solution.
I think you need to CROSSFILTER the relationship. please use the correct analytics in the following
NY-CreditRev30010 =
CALCULATE (
SUM ( gtr[gtr_credit] ),
gtr[gla_id] = "30010",
FILTER (
gts,
gts[gla_id_anal] IN { "0100101", "0200101", "0300101", "0400101" }
),
CROSSFILTER ( gtr[gtr_id], gts[gtr_id], BOTH )
)
GL Account Revenue Credits Revenue Debits Revenue
30010 5,000 4,000 1,000
40010 1,000 2,000 -1,000
50010 500 250 250
The GL accounts are in the GTR table. For each GL Account there are analytic codes in the GTS table. Each analytic code is represents a manufacturer. I have to add up all the credits and debits then subtract the debits from the credits to get Actual Revenue. Credits - Debits = Revenue.
I created one measure for calculating the Credits and one measure for the Debits. Then i created a third measure
to subtract the two to get my Revenue. Credits - Debits = Revenue.
This is the measure for calulating the Credits.
NY-CreditRev30010 = CALCULATE(Sum(gtr[gtr_credit]), (gtr[gla_id] = "30010")filter(gts[gla_id_anal]), gts[gla_id_anal] IN "0100101","0200101","0300101","0400101" )
I get an error saying The syntax for 'filter' is incorrect.
Thanks
Please try this and share a screenshot of the report table/visual
NY-CreditRev30010 =
CALCULATE (
SUM ( gtr[gtr_credit] ),
gtr[gla_id] = "30010",
FILTER (
gts[gla_id_anal],
gts[gla_id_anal] IN { "0100101", "0200101", "0300101", "0400101" }
)
)
Sorry I messed up your measure. Screen shot below is your measure with the correct analytics.
I think you need to CROSSFILTER the relationship. please use the correct analytics in the following
NY-CreditRev30010 =
CALCULATE (
SUM ( gtr[gtr_credit] ),
gtr[gla_id] = "30010",
FILTER (
gts,
gts[gla_id_anal] IN { "0100101", "0200101", "0300101", "0400101" }
),
CROSSFILTER ( gtr[gtr_id], gts[gtr_id], BOTH )
)
You are a genius. Thank you very much.
I had a couple wrong analytics in the measure i sent to and changed them.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |