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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

visual not showing timeline correctly dmicalendar problem

Hi,

 

I have multiple tables wich have two dates fields startdate and enddate. This is why I have created dimstartdates and dimenddates calendars.

Now I have try to create a visual, where there is new hires, new hires same period last year and Number of employees % change.

Measure for new hires is 

New Hires =
 var _date = TODAY()
 var _endofyear = DATE(YEAR(_date),31,12)
 var _startofyear = DATE(YEAR(_date),1,1)
 RETURN
  CALCULATE(  COUNTROWS('Työsopimus'), FILTER( DimStartDate, DimStartDate[Date] <= _endofyear && DimStartDate[Date] >= _startofyear ))

New hires previous year is
New Hires SPLY =
  Var _date = date(year(today())-1, month(today()) , day(TODAY())) //set today to variable
  var endofyeara = DATE(YEAR(_date),12,31) //changes the same period last year end date to end of year
  var periodenddate = MAX(DimStartDate[Date])
  var periodstartdate = MIN(DimEndDates[Date])
RETURN
    CALCULATE(COUNTROWS('Työsopimus'), FILTER( 'DimStartDate', DimStartDate[Date] <= endofyeara),  FILTER(DimStartDate,DimStartDate[Date] <= periodstartdate),  'DimEndDates'[Date] >= periodenddate || DimEndDates[Date]= BLANK()
    )

Then the third measure is Number Of Employees end of last year
NOE_endoflastyear =
Var _date = today()
 var periodenddate = MAX(DimEndDates[Date])
 var periodstartdate = MIN(DimEndDates[Date])

 RETURN
    CALCULATE( COUNTROWS( 'Työsopimus'), FILTER(DimStartDate,DimStartDate[Date] <= periodstartdate), 'DimEndDates'[Date] >= periodenddate || DimEndDates[Date]= BLANK()
   )
if I put the visual time line Month from Dimstartdate table column calues are correct, but noe% is incoorect
vuolleh_0-1657987264654.png


then if I change the month to come from dimenddates table the line is correct but columns not and I can't figure out how to get over this issue (I understand that the problem is that NOE endoflastyear uses dimenddate from where the noe YoY% is calculated and other measures use dimstartdate)

vuolleh_1-1657987502961.png

 



1 ACCEPTED SOLUTION
Anonymous
Not applicable
3 REPLIES 3
Anonymous
Not applicable
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

You can try to use the calculation table to create a date table here, use the date of this date table as the X-axis and do the calculation..

Table =
CALENDAR(
    MIN('Dimstartdate'[Date]),MAX('Dimstartdate'[Date]))

vyangliumsft_0-1658197345048.png

Or change the relationship between tables

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

here is excel with tables used and measures involved to this visual.
https://docs.google.com/spreadsheets/d/1Fi-bRL0TalSatqG2Fs_coCtJbDwShDX4oiMKwDT7Mo8/edit?usp=sharing

 

relationships

vuolleh_0-1658043055921.png

 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors