Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Create a new table with colmuns filtered by dates

Hellow everyone. I am working on a new table that is built from a database that includes this columns:

Clients, Accounts, Dates (from month 1 to month12) and Values

 

And I need to organice in a separate table per Clients and Accounts the values from moth 1, next the values from moth 2 andso on.

I tried with the next code but I find ount that the GENERATE function do not allow dates in the filters and I also cannot add the Accounts column next to the Clients column.

 
Table_1 =
GENERATE (
    VALUES ( Table[Clients] ),
VALUES ( Table[Accounts] ),
    VAR Month1 =
        CALCULATE ( SUM ( Table[Value] ), Table[Month] = "31-01-2022" )
    VAR Month2 =
        CALCULATE ( SUM ( Table[Value] ), Table[Month] = "28-02-2022")
.....
        RETURN
        ROW (
            "Month_1", Month1, "Month_2", Month2
            )
)
 
Thanks in advance!!!
  • Hi Anonymous 

     

    This is my test table:

     

    Please transform data in Power Query: Select Date and Value column - Pivot column.

     

    Select OK:

     

    You will get a table like this, I think this is the expected table you want:

     

    Best regards,

    Yadong Fang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sure! In the next picture I try to show the initial and desired table:

       

      • v-yadongf-msft's avatar
        v-yadongf-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous 

         

        This is my test table:

         

        Please transform data in Power Query: Select Date and Value column - Pivot column.

         

        Select OK:

         

        You will get a table like this, I think this is the expected table you want:

         

        Best regards,

        Yadong Fang

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.