cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Pivot date problem

Hi everyone! I'm pretty sure that my problem could be solved through pivot or unpivot feature, but I encountered a problem that I wasn't able to fix.

 

My dataset looks like:

 

installs

signups

players

sesions

30/5/2020

10

20

30

40

29/5/2020

20

33

44

22

28/5/2020

20

11

33

5

27/5/2020

15

10

22

6

26/5/2020

16

6

8

7

 

I need to show it transposed, like:

 

30/5/2020

29/5/2020

28/5/2020

27/5/2020

installs

10

20

20

15

signups

20

33

..

.

players

..

.

.

sesions

..

..

..

6

 

Using pivot feature, seems to be ok:

1.png2.png

 

But the problem, as the date columns now (due to pivot action) are metrics, I need to select one by one to include it in the table. But as my query datasource every day will return new days ( it recover last 4 days metrcs ) , the "new date" included every day, appears not checked ( as you can see 30/05/2020), so doesn't appear in the table.

 

 

 

Is there any solution to do it ? I mean, I need to show always the days returned into my datasource, with no manually intervention.

 

My .pbix attached, with the original table ( a sample ) and the pivoted table as other

source: https://drive.google.com/file/d/19VX0qKjk25MgowRCIxjBf6MWZ9na_v6Z/view?usp=sharing

 

Thanks in advance,

Regards!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Pivot date problem

Hi @gustavo80 ,

 

You must use the Unpivot column in the query editor.

 

  • Add an index column
  • Select the columns Installs, signups, players and session.
  • Unpivot
  • Get 4 Columns
    • Date
    • Index
    • Attribute
    • Value
  • Add a custom column:
if[Attribute] = "installs" then 1 else
if[Attribute] = "signups" then 2 else
if[Attribute] = "players" then 3 else
4
  • Sort the Date by the last index column and the attribute by the previous column you have created
  • Make you matrix with the following setup:
    • Rows: attribute
    • Columns: Date
    • Values: Values

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Pivot date problem

Hi @gustavo80 ,

 

You must use the Unpivot column in the query editor.

 

  • Add an index column
  • Select the columns Installs, signups, players and session.
  • Unpivot
  • Get 4 Columns
    • Date
    • Index
    • Attribute
    • Value
  • Add a custom column:
if[Attribute] = "installs" then 1 else
if[Attribute] = "signups" then 2 else
if[Attribute] = "players" then 3 else
4
  • Sort the Date by the last index column and the attribute by the previous column you have created
  • Make you matrix with the following setup:
    • Rows: attribute
    • Columns: Date
    • Values: Values

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors