Forum Discussion

samil01's avatar
samil01
Frequent Visitor
4 years ago

How To Sum Without Being Affected By Date Slicer

I want to sum my data measure without affected date slicer. When i use the this dax,

 

Sales = CALCULATE(SUM(FactSales[total_price]),FILTER(FactSales,FactSales[datetime] <=DimComprePeriod[End Compare Period] && FactSales[datetime] >= [Start Compare Period]))
 
it's affected from date slicer. I solved this problem eding "ALL" like this,
 
Sales = CALCULATE(SUM(FactSales[total_price]),FILTER(All(FactSales),FactSales[datetime] <=DimComprePeriod[End Compare Period] && FactSales[datetime] >= [Start Compare Period]))
 
But when i do this total sum is correct but it's makes same value in each row,
 
 
So how can i sum sales row by row?

3 Replies

  • samil01 , On have a separate date table joined with the date of your fact

     

    Sales = CALCULATE(SUM(FactSales[total_price]),FILTER(All(Date),Date[datetime] <=[End Compare Period] && Date[datetime] >= [Start Compare Period]))

     

    Independent date table

    Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

     

    • samil01's avatar
      samil01
      Frequent Visitor

      amitchandakfirst of all thank you for your answer,

       

      I have already a date table but i want to sum totals by hour. For example i want to sum from beginning of the yesterday to until which hour are we in right now, e.g for now i want to sum 2022-05-22 00:00:00 - 2022-05-22 11:00:00 so i need datetime field.

      • v-zhangti's avatar
        v-zhangti
        Icon for Community Support rankCommunity Support

        Hi, samil01 

         

        Can you provide some sample data or simple pbix files? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.

         

        Best Regards,

        Community Support Team _Charlotte

        If this post helps, then please consider Accept it as the solution to help the other members find it more.