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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Kinsley
Frequent Visitor

Table visual with date columns: handling invidual months and a group months in the same table

I have one table visual that contains:

  • Rows: companies names
  • Columns:  10 columns for Mar- Dec/2023
  • Values: Sum of sales quantities

My data contains sales from June/2022 - Dec 2023. Currently Im filtering the visual on all the months in 2023.

Question: I want to add one extra column that is the sum of sales in all the past months (June/2022- Feb/2023)- call this past period. 

How do we do this? and ideally dynamically?

TIA! 

 

Kinsley_0-1677704864992.png

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Kinsley ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1677811945353.png

Please try:

First add a new column:

Period = 
var _a = FORMAT([Date],"MMM-YY")
return IF([Date]>=DATE(2022,6,1)&&[Date]<=DATE(2023,2,28),"Past Period",_a)

Sort = IF([Date]<=DATE(2023,2,28),1,MONTH([Date]))

Output:

vjianbolimsft_1-1677812041650.png

Then Sort the[Period] column by [Sort] column:

vjianbolimsft_2-1677812148914.png

Apply it to the matrix visual:

vjianbolimsft_3-1677812187332.png

Final output:

vjianbolimsft_4-1677812200585.png

Best Regards,

Jianbo Li

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

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Kinsley ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1677811945353.png

Please try:

First add a new column:

Period = 
var _a = FORMAT([Date],"MMM-YY")
return IF([Date]>=DATE(2022,6,1)&&[Date]<=DATE(2023,2,28),"Past Period",_a)

Sort = IF([Date]<=DATE(2023,2,28),1,MONTH([Date]))

Output:

vjianbolimsft_1-1677812041650.png

Then Sort the[Period] column by [Sort] column:

vjianbolimsft_2-1677812148914.png

Apply it to the matrix visual:

vjianbolimsft_3-1677812187332.png

Final output:

vjianbolimsft_4-1677812200585.png

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.