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

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.

Reply
Anonymous
Not applicable

Return value from a filtered dimension which is not in that dimension type.

Hi all, 

 

I have a star schema model, with some simple dimensions; DimDate, DimSite, and DimProduct.

 

I need to subtract and then add some values that are not found under the filter context when selecting SiteType. So for example I need to return the SUM of FactSales with a filter in the report slicers with DimDate (e.g) DimDate[IsPreviousMonth] = 1 and DimSite (e.g) DimSite[SiteType] = "Depot", but then take this and add a SUM from a separate hard-coded measure which is under a different SiteType, for example DimSite[SiteType] = "Office". 

 

I've gotten so far with ALL, however when I filter the report via DimSite[SiteType] it will not return a number and gets filtered out.

 

I am terrible at trying to explain scenarios like this so any questions to make things clearer please let me know.

 

Thanks,

Gordon

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can try to use below measure formula if it suitable for your replacement:

Measure =
VAR Selected =
    CALCULATE (
        SUM ( Fact[Sales] ),
        FILTER ( ALLSELECTED ( DimDate ), DimDate[IsPreviousMonth] = 1 ),
        DimSite[SiteType] = "Depot"
    )
VAR Other =
    CALCULATE (
        SUM ( Fact[Sales] ),
        FILTER ( ALLSELECTED ( DimDate ), DimDate[IsPreviousMonth] = 1 ),
        FILTER ( ALL ( DimSite ), DimSite[SiteType] = "Office" )
    )
RETURN
    selected + Other

If above not help, please share some sample data for testing and coding formula.

 

Regards,

Xiaoxin Sheng

 

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can try to use below measure formula if it suitable for your replacement:

Measure =
VAR Selected =
    CALCULATE (
        SUM ( Fact[Sales] ),
        FILTER ( ALLSELECTED ( DimDate ), DimDate[IsPreviousMonth] = 1 ),
        DimSite[SiteType] = "Depot"
    )
VAR Other =
    CALCULATE (
        SUM ( Fact[Sales] ),
        FILTER ( ALLSELECTED ( DimDate ), DimDate[IsPreviousMonth] = 1 ),
        FILTER ( ALL ( DimSite ), DimSite[SiteType] = "Office" )
    )
RETURN
    selected + Other

If above not help, please share some sample data for testing and coding formula.

 

Regards,

Xiaoxin Sheng

 

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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