Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Missing DateHierarchy N DateIntelligence. Calculate diff. btwn. same period this yr vs last yr.

Hi All,   Pretty new user of Power BI here and faces some difficulties as per listed below. We really hope that someone would gives advice/help on this.   As we are trying to make comparisons be...
  • v-juanli-msft's avatar
    7 years ago

    Hi Anonymous 

    Create three measures

    total value =
    CALCULATE (
        SUM ( Table1[Sales ] ),
        FILTER (
            ALLSELECTED ( Table1 ),
            Table1[Year] = MAX ( Table1[Year] )
                && Table1[Period] = MAX ( Table1[Period] )
                && Table1[Customer ] = MAX ( Table1[Customer ] )
        )
    )
    
    LY =
    CALCULATE (
        [total value],
        FILTER (
            ALLSELECTED ( Table1 ),
            Table1[Year]
                = MAX ( Table1[Year] ) - 1
                && Table1[Period] = MAX ( Table1[Period] )
                && Table1[Customer ] = MAX ( Table1[Customer ] )
        )
    )
    
    growth = IF([LY]<>BLANK(),([total value]-[LY])/[LY])

    Best Regards
    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    7 years ago

    Thank you! This is definitely useful but we are interested to understand why both the Date Hierarchy and Date Intelligence are missing as well. I figured out that it is due to we used "Direct Query" instead of "Import" when we are retrieving the data from the database. Both Date Hierarchy and Date Intelligence are available only when the raw data are retrieved through "Import".