Forum Discussion

s_schultes's avatar
s_schultes
Frequent Visitor
1 month ago
Solved

Filtercontext with date relation

Hi,    I have the following Modell. I was trying to make a Matrix Table with all the Customers (Name) from DimKunde with a date relation between DimDate[Date] and DimKunde[Anlagedatum] and another ...
  • vojtechsima's avatar
    1 month ago

    Hey, s_schultes ,

    Your flag won't be filtered by department, and will send the result to every single department you have. This probably causes the overhelm of Direct Query.

     

    Same also for customers that don't have a revenue or something:

     

    You don't even need the flag. You can just build something like this, which will automatically not display anybody that doesn't have revenue or w/e you're after.

     

    Neukunden Netto = 
    CALCULATE(
        SUM(FactSales[geknetto]),
        USERELATIONSHIP(
            DimDate[Date],
            DimKunde[Anlagedatum]
        )
    )

     


    If you need to display customers by department, you can also do sometheing like this:

    Neukunde Flag Updated = 
    CALCULATE(
        COUNTROWS(DimKunde),
        USERELATIONSHIP(
            DimDate[Date],
            DimKunde[Anlagedatum]
        ),
        TREATAS( VALUES(FactSales[KundeId]), DimKunde[Id])
    )