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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
ruthgammack
Frequent Visitor

Dynamically group based on Date Periods

Hi,

I have a report where i have periods and based on the current date vs the invoiced date end of month i want to set the period. For example if one is invoiced today it would look at the end of month as the 31st October 2021 and set the period to current.  if it was last month it would be period 1 etc. I think i need to use switch but im not 100% so any advice would be great. 

 

Thanks in advance.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ruthgammack , Not very clear

 

But a new column

Switch(true() ,

eomonth([Invoice Date], 0) = eomonth(today(), 0) , "Current" ,

datediff([Invoice Date], 0) , eomonth(today(), 0), month) & ""

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ruthgammack , Not very clear

 

But a new column

Switch(true() ,

eomonth([Invoice Date], 0) = eomonth(today(), 0) , "Current" ,

datediff([Invoice Date], 0) , eomonth(today(), 0), month) & ""

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

sorry will add more context. I need to be able to replicate this static report in Powerbi using the invoiced date and a link to the monthly periods table

 

ruthgammack_0-1634228253386.png

ruthgammack_2-1634228557283.png

 

In the graph right now it displays the period so '202206' 

ruthgammack_4-1634229172136.png

 

but i want to dynamically change that as the months pass by so in this table i would expect the calculated Period to be 

 

ruthgammack_3-1634228913620.png

 

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.