Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Dax Direct Query Treat as

Hello everyone.

 

I faced the problem while using TREAT AS.

I use Storage Mode  as Mixed (some of the data is direct query other dimension tables loaded as import mode)

I need to divide the monthly budget over days of months.

I have used below dax formula:

Budget Sales =
CALCULATE(
    CALCULATE(SUM(FactBudget[Budget]),
      TREATAS(
           VALUES(FactBudget[Year_Month]),DimDate[MonthnYear])),
              CROSSFILTER(FactBudget[TransDate],DimDate[Date],None))
 
Does TREATAS work with Direct Query (Live Connection)
 
Thanks in advance
dax
 

1 Reply

  • Anonymous ,

    This is what the document says

    This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

     

    Can you share sample data and sample output in table format?

     

    try like

    Budget Sales =
    CALCULATE(
        CALCULATE(SUM(FactBudget[Budget]),
          filter(FactBudget,
               FactBudget[Year_Month] in values( DimDate[MonthnYear])),
                  CROSSFILTER(FactBudget[TransDate],DimDate[Date],None))