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
Anonymous
Not applicable

showing Quarter based results

Hi,

 

I have vendor data with the spend for each month.I have 12 columns for month.

 

I need to show each quarter spend for vendor.As months are in columns, i am not sure what is the best way to do this.

 

Please suggest.

 

Thanks

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Anonymous,

 

in the query editor unpivot your month columns and you will get two columns with Month and values then calculate your QTD values from there.

 

Regards,

MFelix


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

v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

If you need to keep the monthly data, please replicate the source table, then, based on the replicated table, you could generate the quarterly data in Query Editor mode.

 

Select the [Vendor] column, then click Unpivot other columns.

1.PNG

 

After unpivoting table, you should add a conditional column like below.

2.PNG

 

Alternatively, you can add a custom column using this code rather than UI operation as above image shows. 

=if List.AnyTrue(List.Transform({"Jan","Feb","Mar"}
,(substring) => [Month]= substring)) 
then "Quarter1" 
else if List.AnyTrue(List.Transform({"Apr","May","Jun"}
,(substring) => [Month]= substring)) 
then "Quarter2" 
else if List.AnyTrue(List.Transform({"Jul","Aug","Sep"}
,(substring) => [Month]=substring)) then "Quarter3" 
else "Quarter4"

3.PNG

 

Then, please group data records based on vendor and quarter.

4.PNG

 

Then, pivot table. Select [Quarter] column, click Pivot column, make settings in "Pivot Column" dialog as below.

5.PNG

 

Final result.

6.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

If you need to keep the monthly data, please replicate the source table, then, based on the replicated table, you could generate the quarterly data in Query Editor mode.

 

Select the [Vendor] column, then click Unpivot other columns.

1.PNG

 

After unpivoting table, you should add a conditional column like below.

2.PNG

 

Alternatively, you can add a custom column using this code rather than UI operation as above image shows. 

=if List.AnyTrue(List.Transform({"Jan","Feb","Mar"}
,(substring) => [Month]= substring)) 
then "Quarter1" 
else if List.AnyTrue(List.Transform({"Apr","May","Jun"}
,(substring) => [Month]= substring)) 
then "Quarter2" 
else if List.AnyTrue(List.Transform({"Jul","Aug","Sep"}
,(substring) => [Month]=substring)) then "Quarter3" 
else "Quarter4"

3.PNG

 

Then, please group data records based on vendor and quarter.

4.PNG

 

Then, pivot table. Select [Quarter] column, click Pivot column, make settings in "Pivot Column" dialog as below.

5.PNG

 

Final result.

6.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MFelix
Super User
Super User

Hi @Anonymous,

 

in the query editor unpivot your month columns and you will get two columns with Month and values then calculate your QTD values from there.

 

Regards,

MFelix


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



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.