Multiple dates in one table

  • Multiple dates in one table

    Posted by DSC Communities on May 12, 2020 at 7:37 pm
    • Waseem Dar

      Member

      May 12, 2020 at 7:37 PM

      ?Appreciate some help here. Developing a BI report from Employees table. It has Hire, rehire and termination dates. IĀ have separate Clustered Column Chart for on-board and off-board headcounts on the same page – so 2 visuals on the same page one based on hire date and the other based on termination date. 2 slicers are set up – one for company selection and other for year selection. I then added a calendar table as ‘CalendarAuto’ and linked the ‘date’ columnĀ with hire, rehire and termination dates through Manage Relationship. When I adjust the Year slicer bar – say to year 2019 – 2020, the visuals do not give correct data. The visuals should follow the year from slicer bar selection. I have attached screenshots here. What I am doing wrong?

      ——————————
      Waseem Dar
      Business Analyst
      ——————————

    • Mark Beedle

      Member

      May 13, 2020 at 1:32 AM

      Hi Waseem,

      There can only be 1 active relationship between the Calendar table and your Employees table.Ā  If you check in Manage Relationship, I suspect that the relationship between Calendar and termination date is set to inactive.Ā  Power BI (and SSAS Tabular) do not allow more than one active relationship between two tables.Ā  If you want 1 slicer to filter both tables, based on 2 different dates/relationships, you’ll probably need to write a measure thatĀ activates the inactive relationship based on termination date.Ā  Assuming your measure is some kind of sum on headcount, the new measure would be something like:

      Terminated Headcount = CALCULATE(SUM(‘YourTableName'[Headcount]), USERELATIONSHIP(‘YourTableName'[TerminationDate],’Calendar'[Date]))

      Let me know if that works for you.

      ——————————
      Mark Beedle
      Business Intelligence Developer and Administrator
      TempurSealy Inc.
      Lexington KY
      ——————————
      ——————————————-

    • Mark Beedle

      Member

      May 13, 2020 at 11:37 PM

      Hi Waseem,

      Just to clarify, in order to USERELATIONSHIP to work in the measure, make sure that there is a relationship (even if inactive) established between your ‘Employees’ table and ‘Calendar’ table.Ā  I think your original post said that you established that relationship based on TerminationDate.

      ——————————
      Mark Beedle
      Business Intelligence Developer and Administrator
      TempurSealy Inc.
      Lexington KY
      ——————————
      ——————————————-

    • Waseem Dar

      Member

      May 15, 2020 at 11:44 AM

      Thanks Mark, yes, I took the relationship off during my struggle to fix the issue.

      ——————————
      Waseem Dar
      Business Analyst
      ——————————
      ——————————————-

    • Raul Vinuesa Arjona

      Member

      May 14, 2020 at 2:24 AM

      Agreed with @Mark , this practice Will solve your problem @Waseem

      ——————————
      RaĆŗl Vinuesa Arjona
      Controller | Lean Yellow Belt | Business Intelligence
      ——————————
      ——————————————-

    • Waseem Dar

      Member

      May 15, 2020 at 11:45 AM

      Thanks Raul for looking it to this.

      ——————————
      Waseem Dar
      Business Analyst
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Multiple dates in one table’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!