Forum Discussion

hari_krishnan's avatar
6 years ago
Solved

Creating new table in Direct query mode from existing one

Hi,   I have a Date range filter within my report which pulls data from the Reg_Date column from below table:   ID Reg_Date Gender Age 1 2020-10-03 12:12:12 M 20 2 2020-11-03 12...
  • MFelix's avatar
    6 years ago

    Hi  hari_krishnan ,

     

    Have you tried instead of creating a new table, making a measure using a switch function and a table with the stages something similar to this:

     

    Measure =
    SWITCH (
        SELECTEDVALUE ( TableStage[Stage] );
        "A"; CALCULATE ( COUNT ( Table[Name] ); Table[Gender] = 'M' );
        "B"; CALCULATE ( COUNT ( Table[Name] ); Table[Age] = 20 );
        ...
    )

     

    Can work as you need, because the measure are based on context and if they are calculated based on the initial table they will be filtered out by the dates.

     

    Be aware that the Stage only needs to have  A, B, C and so on without any relationship with the other table.