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
rayinOz
Helper III
Helper III

Cumulative Bar Chart - How to Hide Months Without Affecting Values

Hello Community!

 

In my month to month cumulative bar chart, i'm wondering how to hide earlier months (to fucus more on recent months and keep the bar chart smaller) without affecting the numbers. Whenever I filter using the visual fiter to hide months, it also adjusts the values... which I don't want.

 

thoughts?

 

2017-03-27_13-44-32.png

1 ACCEPTED SOLUTION

Hi @rayinOz

 

I go about doing this as follows.

 

I am assuming you have a calendar table which is based on the min to max dates of your main fact table.

 

Try the following

1.  Create a column called Monthnumber in your calendar table

    MonthNumber = MONTH([Date])

2.  Create a column called MonthSequentialNumber in your calendar table

     MonthSequentialNumber = year([Date])*12 + Calendar[MonthNumber] – 1

3.  Create a measure called 

      MaxDate = Max('Calendar'[Date])

4. Create a column called Show  in Calendar table 

 

 

                  Show = If ( [MonthSequentialNumber] >= [CurMonthSerialNumber] -11 &&
                                                     [MonthSequentialNumber] <= [CurMonthSerialNumber] ,
                                                                     1,
                                                                            0

                                                         )

What this does for each row in calendar table it checks whether the month sequential number is less than 12 months including the max current month. If so set it as 1 else 0.

I have used the last 12 months to be displayed including the current month in my case. You may change this value 11 to display as many months backwards you want to show.

 

5. In the visual filters for the chart set Show equals 1.

 

If this resolves your issue accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

6 REPLIES 6
v-huizhn-msft
Employee
Employee

Hi @rayinOz,

Please try the solution @Sean posted, and mark the reply as answer if you have resolved your issue. If your issue still exist, please feel free to ask.

 

Best Regards,
Angelia

Sean
Community Champion
Community Champion

Plot your CalendarTable[Date] on the X-Axis while using your Table [Date] in your Cumulative Total Measure! Smiley Happy

(and also use the CalendarTable[Date] for the Slicers and in Visual Level Filters, etc...)

Running Total - Not Affected by Slicers.gif

Sean,

 

I'm a novice so that didn't quite make sense to me. I do have a date table and measures within my file (see below chart image). However i was able to change the x-axis formatting start date via the formatting panel. Visually it made the change I wanted without affecting the data. Unless it causes other changes that I haven't been able to notice.

 

cu-chart.png

 

 Take a look at the fields in my pbi file.

cu-fields.png

 

 

 

and my bar chart visualisations

cu-chart-visualisations.png

 

 What do you think?

 

 

 

 

Hi @rayinOz

 

I go about doing this as follows.

 

I am assuming you have a calendar table which is based on the min to max dates of your main fact table.

 

Try the following

1.  Create a column called Monthnumber in your calendar table

    MonthNumber = MONTH([Date])

2.  Create a column called MonthSequentialNumber in your calendar table

     MonthSequentialNumber = year([Date])*12 + Calendar[MonthNumber] – 1

3.  Create a measure called 

      MaxDate = Max('Calendar'[Date])

4. Create a column called Show  in Calendar table 

 

 

                  Show = If ( [MonthSequentialNumber] >= [CurMonthSerialNumber] -11 &&
                                                     [MonthSequentialNumber] <= [CurMonthSerialNumber] ,
                                                                     1,
                                                                            0

                                                         )

What this does for each row in calendar table it checks whether the month sequential number is less than 12 months including the max current month. If so set it as 1 else 0.

I have used the last 12 months to be displayed including the current month in my case. You may change this value 11 to display as many months backwards you want to show.

 

5. In the visual filters for the chart set Show equals 1.

 

If this resolves your issue accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

Hello,

I am having the same issue and trying to implement your solution. Can you please specify what represents [CurMonthSerialNumber]  in this calculation?

 

Show = If ( [MonthSequentialNumber] >= [CurMonthSerialNumber] -11 &&
                                                     [MonthSequentialNumber] <= [CurMonthSerialNumber] ,
                                                                     1,
                                                                            0

                                                         )

 

Regards,

M.R.

Hi @Anonymous ,

 

The CurMonthSerialNumber  is the same as the MonthSequentialNumber but based on the CurrentDate = TODAY().

 

Hope this clarifies

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

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.