Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NOVICE02
Helper III
Helper III

Metrics by days in columns

Hi All,

Posted this question before and got some direction but need more.

My transactional data looks like this. It's thousands of rows for each day with multiple variables. 

 

IDVariableVariable2Date
xxxxxxJan 1
xxxxxJan 2

right now I can only have it with the date running down vertically and the variable summaries running down vertically as well.

 

 

I need to summarize data like below.

 Jan1Jan2Jan3 
variable1sum/count/measure   
variable2Sum/count/measure   

I have tried showing the values in rows but realized later that the subcolumn totals are all wrong.... it doesn't make any sense. I need to keep it in direct query mode so i tried the following as a test to unpivot but this is not working either...

select
  cal_date,
  Calls_Handled
from
 OB_Portfolio4 unpivot (
    Volumes for Metrics IN (Calls_Handled AS 'Calls_Handled ')
  );

but keep getting this error:   Details: "Microsoft SQL: Incorrect syntax near the keyword 'AS'."

Any direction would be appreciated

2 ACCEPTED SOLUTIONS
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create a table to test:

61.PNG

Please take following steps:

1)Unpivot the columns [Variable] and [Variable2] in table in Query Editor:

62.PNG

2)After Apply&Close, create a measure:

Measure = SUM('Table'[Value])

3)Choose a matrix visual and it shows the sum of [Variable] and [Variable2] for each day:

63.PNG

 

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

Hi,

 

Please try to enter a table like this:

91.PNG 92.PNG

Then create a calculated column in 'Table(2)':

Column = IF('Table (2)'[Attribute]="Variable",RELATED('Table'[Variable]),RELATED('Table'[Variable2]))

And it shows:

93.PNG

Then create a measure:

Measure = SUM('Table (2)'[Column])

Choose a matrix visual, it shows:

94.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

3 REPLIES 3
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create a table to test:

61.PNG

Please take following steps:

1)Unpivot the columns [Variable] and [Variable2] in table in Query Editor:

62.PNG

2)After Apply&Close, create a measure:

Measure = SUM('Table'[Value])

3)Choose a matrix visual and it shows the sum of [Variable] and [Variable2] for each day:

63.PNG

 

Hope this helps.

 

Best Regards,

Giotto Zhi

Hi Giotto,

 

Thanks so much but i cannot unpivot that way i am using direct query. it saying that i have to go into import mode. Is there another way?

Hi,

 

Please try to enter a table like this:

91.PNG 92.PNG

Then create a calculated column in 'Table(2)':

Column = IF('Table (2)'[Attribute]="Variable",RELATED('Table'[Variable]),RELATED('Table'[Variable2]))

And it shows:

93.PNG

Then create a measure:

Measure = SUM('Table (2)'[Column])

Choose a matrix visual, it shows:

94.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.