Forum Discussion
Bas (howtopowerbi) datatable issue
I am trying to recreate Bas Datatable - as everything went ok on his data, I started to implement it on my data.
Link to Bas video: https://www.youtube.com/watch?v=pRd_PDsW41A
I cannot achieve labels to occur in first column:
I have made debugging of this measure in my conditions, trying to check what is wrong and I have noticed that Bas measure in my conditions is returning Blank() instead of -1 as on his data:
RowLbl1Pos =
VAR _FirstDate = CALCULATE( MIN( fctSales[Order Date] ))
VAR _PeriodOffset =
SWITCH(
TRUE,
ISINSCOPE( dimCalendar[Month] ), -1,
ISINSCOPE( dimCalendar[Quarter] ), -3,
-12
)
VAR _PeriodRowLbl = EOMONTH( _FirstDate, _PeriodOffset )
VAR _Lbl =
IF(
MIN( dimCalendar[Date] ) <= _PeriodRowLbl
&& MAX( dimCalendar[Date] ) >= _PeriodRowLbl,
-1
)
RETURN
_Lbl
Could you give me a hint whats wrong?
https://drive.google.com/file/d/1bxGZw_FJ1pPRxcjCvujOgMs-Tbvixfzm/view?usp=sharing
1 Reply
- johnt75Super User
There's a couple of things. You need to add ALLSELECTED(dimCalendar) to the _FirstDate calculation. You also need to make sure that dimCalendar has dates upto 12 months before what's in the order table, otherwise the IF condition will never return true - _PeriodRowLbl will always be less than the min date.