Club Power BI

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
 View Only
  • 1.  Mindate or firstdate crossing with a filter

    Posted Feb 01, 2023 09:26 AM
      |   view attached

    Hi 

     

    I am desperate to find a solution despite the various answers found on this forum:

     

    I have a "date" table => time[Date]
    I have an "agent" table => Agent[Agent]
    I have a "volume" measure => '_01-Agent Work Measures'[Nb Workflowstep]

     

    => it means that I cross my agents who have handled X volumes (Nb Workflowstep) at a given date.

     

    I would like to know for each agent, the first date on which it has volumes.

     

    I have tested several formulas which all give me the same result (i.e. my oldest date in my dataset).

     

    Tested :

     

    1/ date min = min('Time'[Date])
    Works without filter context, my earliest date is 1/01/2020.
    Does not work for my Agent XXXXX  for whom the date should be 21/09/2020.


    2/ CALCULATE([date min], filter(Agent, Agent[Agent] = "Name of Agent"))
    Returns 1/01/2020 => false
    Should return the earliest date for this agent.


    3/ CALCULATE(FIRSTDATE('Time'[Date]), FILTER('Agent','_01-Agent Work Measures' [Nb Workflowstep]>50))
    Returns 1/01/2020 => false
    Should return the date from the moment I have a value > 50


    4/ CALCULATE(FIRSTDATE('Time'[Date]),ALLSELECTED('Time'[Date]), FILTER(Agent, '_01-Agent Work Measures'[Nb Workflowstep]>50))
    Returns 1/01/2020 => false
    Should return the date from the moment I have a value > 50


    5/ CALCULATE([date min],FILTER('Agent','_01-Agent Work Measures'[Nb Workflowstep]>100))
    Returns 1/01/2020 => false
    Should return the date from the moment I have a value > 100

     

    Here is a screenshot.

     

    Let me know if you need further details : 

     

    Many thanks in advance

     

    Sou



    ------------------------------
    Souad MOHAMMED SBA
    ------------------------------


  • 2.  RE: Mindate or firstdate crossing with a filter

    Posted Feb 01, 2023 07:08 PM

    Hi,
    First question is : do you have a "date" column in your "Agent" table ?

    could you tell us what are the relashionships in your data set ? 

    If i'm not wrong, you might have related "Time" table to "Agent" one. 

    Anyway, the usual way of this relation is that your Time table Filters your Agent Table.
    What seems to happen here, is that you try to filter your time table by your agent one.

    If you have a date column in your Agent Table, then your "date min" measure should be  : Date min = min('Agent'[Date])

    After that; you can filter your agent table the way you want, you should obtain what you want.

    if i'm wrong, smaybe i can help better with the relationship view



    ------------------------------
    ludovic ROBIN
    ------------------------------



  • 3.  RE: Mindate or firstdate crossing with a filter

    Posted Feb 02, 2023 02:51 AM
    Thank you very much Ludovic for taking time to answer to me !
    I speak french also :) but let us continue in english for other users :-)

    I verified the data model, and there is no relation between both tables :

    Agent table : Agent[Agent]
    Time table : Time[Date]

    Now I understand why it doesn't work hahahahaha.

    Do you think I can improve my formula without this relation ?

    Thanks again,

    Sou


    ------------------------------
    Souad MOHAMMED SBA
    ------------------------------



  • 4.  RE: Mindate or firstdate crossing with a filter

    Posted Feb 02, 2023 04:19 AM
    No problem

    If you have no relation between those 2 tables, you can only filter in the same table.

    So if you have a date column in your 'agent' table, then filter it like i mentioned.  If it's not the case, you won't be able to filter date

    ------------------------------
    ludovic ROBIN
    ------------------------------



  • 5.  RE: Mindate or firstdate crossing with a filter

    Posted Feb 02, 2023 04:43 AM
    I found a Date column in the Agent table but It means somehting else I want to analyze. It means the date where the agent started working. ...

    MIN(Agent[Agent - Validity Date -  Start])

    So I think, I can't do what I want :-( ...

    thank you Ludovic for your time !

    Sou


    ------------------------------
    Souad MOHAMMED SBA
    ------------------------------