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
crobson29
Helper I
Helper I

How to have a table show the month in a slicer and the previous month

Hello everybody,

I have a problem that is really getting me.  I have a report that shows multiple KPIs as line graphs that show cumulative sales for the current month, last month, and the current months budget.  These graphs also have a table next to them that show the current month, last month, and a calculation comparing them.  It looks like this:

crobson29_0-1714661454830.png

I also have a slicer at the top of the page that shows "Current Month" for this month, and the month name for all the others.  The graphs are working perfectly, the problem is the table.  Currently, I have the tables decoupled from the slicer, and the measure has a calculate function to only show the current month and the previous month.  

 

I have just been asked to have the table react to the slicer.  The problem I am having is that if I turn on the interaction between the table and the slicer, it only shows one month at a time.  I was trying to use the SELECTEDVALUE function, but it didn't seem to work.  Here are the formulas for the Month Slicer and the current measure I have built:

 

Month_Slicer = SWITCH(
    TRUE,
    M_CALENDAR_BILLING[Month Num] == MONTH(TODAY()), "Current Month",
    M_CALENDAR_BILLING[Month]
)

 

Containers for table = CALCULATE(
    [Current Month Cumulative (Containers)],
    M_CALENDAR_BILLING[Day] <= DAY(TODAY()),
    M_CALENDAR_BILLING[Month Num]== MONTH(TODAY())-1 || M_CALENDAR_BILLING[Month Num] == MONTH(TODAY())
)
 
Does anyone have any suggestions?
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@crobson29,

 

Here's an article on the topic. The example DAX can also be used in a measure.

 

https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ 





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @crobson29 ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

DataInsights
Super User
Super User

@crobson29,

 

Here's an article on the topic. The example DAX can also be used in a measure.

 

https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ 





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

Proud to be a Super User!




I believe this will work, I have an additional complication that I will need to deal with since I am using a DirectQuery connnection which does not allow calculated tables.  I think there is a relatively easy workaround, I just need to put in some time in Power Query.  Thank you

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors