Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Automatically Select and update latest four columns to data table

Hi,

I want to update the latest four columns of data automatically on my dashboard. When I update the next date to my excel data base dashboard should select the latest four data columns and publish in on the dashboard. column names are dates as follows

 

 

 

 

  • hi again 

    i have creat 2 example in power query: 

     

    Example 1:

     

    example 2:

     

     

    you can use the same link to view the pbix. 

     

    Best regards

    Bruno Costa | Responsive Resident

     

    Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! πŸ‘

    Take a look at the blog: PBI Portugal 

4 Replies

  • onurbmiguel_'s avatar
    onurbmiguel_
    Icon for Power Participant rankPower Participant

    Hello, 

    You need to change your model.
    Unpivot the data columns, to have something like this:

     

    Example of power query: 

     

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tdO5FcAgEMTQXjYmYMbgowE3waP/NiCjgVWg9GcaI35Fidxm2awZ9mLYxrCdYW+GfRj2ZdiPYVUhN9c8LjSaoNMErSboNUGzCbpN0G6CfjP0m3PN40K/GfrN0G8GfpsL", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Object " = _t, #"4/7/2022" = _t, #"4/8/2022" = _t, #"4/9/2022" = _t, #"4/10/2022" = _t, #"4/11/2022" = _t, #"4/12/2022" = _t, #"4/13/2022" = _t, #"4/14/2022" = _t, #"4/15/2022" = _t, #"4/16/2022" = _t, #"4/17/2022" = _t, #"4/18/2022" = _t, #"4/19/2022" = _t, #"4/20/2022" = _t, #"4/21/2022" = _t, #"4/22/2022" = _t, #"4/23/2022" = _t, #"4/24/2022" = _t, #"4/25/2022" = _t, #"4/26/2022" = _t]),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Object "}, "date", "Value"),
        #"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Columns",{{"date", type date}})
    in
        #"Changed Type"

     

     

    Also the pbix with this example: Unpivot.pbix

     

    https://1drv.ms/u/s!AkcWVrMFkXs1h7NSMjQ64mxTamhKZw?e=X60LNn

     

    output:

     

     

     

    Best regards

    Bruno Costa | Responsive Resident

     

    Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! πŸ‘

    Take a look at the blog: PBI Portugal 

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks onurbmiguel,

    Can I select the latest four columns while I selecting column from excel power query editor?

    • onurbmiguel_'s avatar
      onurbmiguel_
      Icon for Power Participant rankPower Participant

      hi again 

      i have creat 2 example in power query: 

       

      Example 1:

       

      example 2:

       

       

      you can use the same link to view the pbix. 

       

      Best regards

      Bruno Costa | Responsive Resident

       

      Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! πŸ‘

      Take a look at the blog: PBI Portugal 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Thanks BrunoπŸ‘