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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Applicable88
Impactful Individual
Impactful Individual

Calculated Column as a dimension with "Current Month"

Hello,

 

In my Mastercalendartable I have a  YearMonthKey columnn like : 

 

Date  Values AccountingMonth
28.07.2022 10 202207 
29.07.2022 10 202208 
30.07.2022 0 202208 
31.07.2022 0 202208 
01.08.2022 20 202208 
02.08.2022 20 202208

 

I want to add a caluclated column as a dimension for my report. When its the current month, for example 202208, I want it to display "Current Month" instead. The problem as you can see is that not all days are equal to the calendar month, since I'm using the accounting month where the last working days of a month already belongs to the next month.

 

Because of that fact I cannot use something like this:

CurrentMonth Columns=
var _YearDate = YEAR(Today())
var _MonthDate= Month(Today())
var _DateDate2 = if (len(_MonthDate)=1, 0 &_MonthDate, _MonthDate)
var _TodaysYearMonth= Format ( _YearDate &_MonthDate2,"#######")
return

If (MasterCalendar[AccountingMonth] = _TodaysYearMonth, "Current Month", MasterCalendar[AccountingMonth]

 

Because the function Today() is always base on the calendar month it would give me the wrong AccountingMonth Key when its for 

example July 29th or July 30th, since those days are already belonging to Accounting Month August.

 

Thank you very much in advance. 

Best. 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Applicable88 

You can use a LOOKUPVALUE on TODAY() to get the accounting month for today then compare that to your accounting month column and add a new column.

Account Month Current = 
VAR _CurrentAccountingMonth = LOOKUPVALUE('Table'[AccountingMonth],'Table'[Date ],TODAY())
RETURN IF ( 'Table'[AccountingMonth] = _CurrentAccountingMonth, "Current Month", 'Table'[AccountingMonth] )

jdbuchanan71_0-1659538824032.png

 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Applicable88 

You can use a LOOKUPVALUE on TODAY() to get the accounting month for today then compare that to your accounting month column and add a new column.

Account Month Current = 
VAR _CurrentAccountingMonth = LOOKUPVALUE('Table'[AccountingMonth],'Table'[Date ],TODAY())
RETURN IF ( 'Table'[AccountingMonth] = _CurrentAccountingMonth, "Current Month", 'Table'[AccountingMonth] )

jdbuchanan71_0-1659538824032.png

 

@jdbuchanan71 thank you very much. Very straight forward solution!

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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