Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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] )
User | Count |
---|---|
84 | |
75 | |
73 | |
42 | |
36 |
User | Count |
---|---|
114 | |
56 | |
52 | |
43 | |
42 |