Forum Discussion

kulpowerbi's avatar
kulpowerbi
Helper I
5 years ago

Calculate function is showing same value for each axis

Please help me to understand what's wrong with this.

 

I am trying to filter simple measure like sum measure with calcualte and it should return the value for only suppose year 2019.

I have my calendar table linked with my sale table with date column (1 to many).

But while applyign the measure I got data filtered for 2019 but X axis in line chart is still showing all the years with fitlered value for 2019.

Here is the image for your refrence:

If i tried to put Year from the sales table but not from calender. The Result is showing correclty for 2019 only but I have to use the calendar table.

4 Replies

    • kulpowerbi's avatar
      kulpowerbi
      Helper I

      parry2k  ryan_mayu Greg_Deckler  amitchandak 
      I have already tried. Filter inside my dax. WHile debuging I only found the issue of AND function here.. If i put 1=1 in true function or any thing wihout measure in left side then the result is showing value for only 2015 while year hirachy is showig in chart. 

      M_Sales_dynamic date range for each Bookmark = 
      //IF([M_Bookmark_Selection]="1", CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Year]=2015)),0)
      IF(AND([M_Bookmark_Selection]="1", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Year]=2015)),
      IF(AND([M_Bookmark_Selection]="2", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Quarter]="Q2")),
      IF(AND([M_Bookmark_Selection]="3", [Slider_Min_Max_Date]="T"), CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[Month]="May")),
      CALCULATE(Sales[Sales],FILTER('Calendar','Calendar'[WeekdayNum]=1)))))

       My data is not matching pleas see below screenshot and PowerbI file.