Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
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] )
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] )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |