Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Lucian
Responsive Resident
Responsive Resident

Account scheme reports in Power BI with extra filtering

Hello,

 

I need some help with a Profit & Loss report.

With @ImkeF 's help in her article Easy Profit and Loss and other (account) scheme reports in Power BI and Power Pivot using DAX I have managed to use that "magic measure" to display the info using the "ReportsAccountsLayout".

 

MyMagicMeasure := CALCULATE([StandardMeasure], AccountsAllocation)

 

 Now, the management came with another ideea - to restrict some calculations based on a new dimension, so the "fact" table has a new tag column and also the ReportsAccountsLayout has this tag column.

For example for a specific "account key" I have to get data only if there is also that "extra dimension" present.

 

For example there are 2 reports almost the same, except that on report A the account 1 & 2 should be "extra filtered" by the "ExtDim" column.

The ReportsAccountsLayout is in my case named AcctSched

SchedNameRowNoDescAccountExtDim
A1S11Z
A2S22X
A3S33 
C1S11 
C2S22 
C3S33 

 

The fact table look like this

Entry_NoAccountDescExtraDIMAmount
11AZ10
21B 20
32C 30
42DX40
53E 50

 

So when I select report A the report should look like this (with total 100)

SchedA.png

But when select report C the total should be 150, and in my case is same as A (100).

 

SchedC.png

To make it work for report "A", I have created in AcctSched a new column combining [Account]&[ExtDim]

= Table.AddColumn(#"Added Custom", "SchedAccDim_PK", each [Account]&[ExtDim])

 Then duplicate this table letting only this "key" to obtain the "interim" table to be able to connect back to Fact table.

 

Schema.png

 

The problem is that when report C is selected, because there are "no requirements" to filter for that extra-dimension I should get a total amount of 150 not 100.

 

What am I missing or "excessive filtering"?

 

I cannot upload PBIX file directly but I've loaded it here: Filter Extra Dim - Community.pbix 

 

Kind Regards,

Lucian

1 ACCEPTED SOLUTION
Lucian
Responsive Resident
Responsive Resident

Well,

 

After some digging I (think) I found the answer.

Trying to disable the relationship between AcctSched and AcctSched-ExtraDim-Interim and activate it with USERELATIONSHIP only when AcctSched[ExtDim] has a value I found that relationship will never activate.

So digging more to find out why, I found this article: USERELATIONSHIP does not override active relationship because I have also created an "ambigous path".

So, instead of the simple "magic measure"

 

 

 

ActualAmount = CALCULATE([Total Amount],AcctSched)

 

 

 

I have to calculate differently when there is no "extra" AcctSched[ExtDim]:

 

 

 

ActualAmount2 = 
VAR __ExtraFilterValue =
    IF ( HASONEVALUE ( AcctSched[ExtDim] ), MAX ( AcctSched[ExtDim] ), BLANK () )
VAR __Mode1 =
    CALCULATE ( [Total Amount], AcctSched )
VAR __Mode2 =
    CALCULATE (
        [Total Amount],
        ALL ( AcctSched ),
        'Fact'[Account] IN VALUES ( AcctSched[Account] )
    )
RETURN
    IF (
        HASONEVALUE ( AcctSched[ExtDim] ) && ISBLANK ( __ExtraFilterValue ),
        __Mode2,
        __Mode1
    )

 

 

 

And this way it seems to work correctly on the test report.

 

SchedA2.png

SchedC2.png

I did't test it yet on the real report, so if someone have other ideeas or improvements I'm opened to any suggestion.

 

And the final/working report just if someone will need it (eventually me over some time 😉) :
Filter Extra Dim - Community-Solved.pbix  

 

Kind Regards,

Lucian

View solution in original post

1 REPLY 1
Lucian
Responsive Resident
Responsive Resident

Well,

 

After some digging I (think) I found the answer.

Trying to disable the relationship between AcctSched and AcctSched-ExtraDim-Interim and activate it with USERELATIONSHIP only when AcctSched[ExtDim] has a value I found that relationship will never activate.

So digging more to find out why, I found this article: USERELATIONSHIP does not override active relationship because I have also created an "ambigous path".

So, instead of the simple "magic measure"

 

 

 

ActualAmount = CALCULATE([Total Amount],AcctSched)

 

 

 

I have to calculate differently when there is no "extra" AcctSched[ExtDim]:

 

 

 

ActualAmount2 = 
VAR __ExtraFilterValue =
    IF ( HASONEVALUE ( AcctSched[ExtDim] ), MAX ( AcctSched[ExtDim] ), BLANK () )
VAR __Mode1 =
    CALCULATE ( [Total Amount], AcctSched )
VAR __Mode2 =
    CALCULATE (
        [Total Amount],
        ALL ( AcctSched ),
        'Fact'[Account] IN VALUES ( AcctSched[Account] )
    )
RETURN
    IF (
        HASONEVALUE ( AcctSched[ExtDim] ) && ISBLANK ( __ExtraFilterValue ),
        __Mode2,
        __Mode1
    )

 

 

 

And this way it seems to work correctly on the test report.

 

SchedA2.png

SchedC2.png

I did't test it yet on the real report, so if someone have other ideeas or improvements I'm opened to any suggestion.

 

And the final/working report just if someone will need it (eventually me over some time 😉) :
Filter Extra Dim - Community-Solved.pbix  

 

Kind Regards,

Lucian

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.