Forum Discussion

Victor_1706's avatar
Victor_1706
New Member
7 years ago
Solved

How to order by weeks (chronologically)

  Hello everyone.     I have little time using Power BI and I am still adapting to the tool. I'm modeling data to show the total number of organizations for each of the stages in my sales process...
  • v-frfei-msft's avatar
    v-frfei-msft
    7 years ago

    Hi Victor_1706,

     

    I created one measure to get the count of days per organization.

     

     

    Measure = 
    VAR mindate =
        CALCULATE (
            MIN ( deals[Último cambio de etapa] ),
            ALLEXCEPT ( deals, deals[Etapa] )
        )
    VAR maxdate =
        CALCULATE (
            MAX ( deals[Último cambio de etapa] ),
            ALLEXCEPT ( deals, deals[Etapa] )
        )
    RETURN
        DATEDIFF ( mindate, maxdate, DAY )
    

     

    For more details, please check the pbix as attached.

     

    Regards,

    Frank

     

  • v-frfei-msft's avatar
    v-frfei-msft
    7 years ago

    Hi Victor_1706,

     

    Which column is the code? You can update the formula to it.

     

    Measure = 
    VAR mindate =
        CALCULATE (
            MIN ( deals[Último cambio de etapa] ),
            ALLEXCEPT ( deals, deals[Etapa],deals[code] )
        )
    VAR maxdate =
        CALCULATE (
            MAX ( deals[Último cambio de etapa] ),
            ALLEXCEPT ( deals, deals[Etapa],deals[code] )
        )
    RETURN
        DATEDIFF ( mindate, maxdate, DAY )
    

    Regards,

    Frank