Forum Discussion

arvindyadav's avatar
arvindyadav
Icon for Post Partisan rankPost Partisan
7 years ago

Total value is not correct.

Hi Team,

 

I am getting total value Incorrect.

The total value display in power bi for the entire month of the previous period but I need only total value for the previous period for current date matching.

 

Please find measure for the previous period:

previous period = 

Previous Period Profit = CALCULATE(SUM(Table1[Profit]),SAMEPERIODLASTYEAR(Table1[Date]),ALL('Table1'))
 
and measure for current month :
This Month Profit = CALCULATE(SUM(Table1[Profit]),FILTER(Table1,YEAR(Table1[Date])=YEAR(TODAY()) && MONTH(Table1[Date])=MONTH(TODAY())))
 
 
The total of Previous period profit displaying from 7/1/2018 to 7/31/2018 i.e, $412025.00 but I need to correct the profit to display as 7/1/2018 to 7/28/2018 i.e, the profit is $37300.13.
 
Thanks,
Arvind

12 Replies

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

    Hi arvindyadav ,

     

    You can try to create a measure like DAX below.

     

    Previous Period Profit = CALCULATE(SUM(Table1[Profit]),DATEADD(Table1[Date],-12,MONTH))

     

    Best Regards,

    Amy

     

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

     

    • arvindyadav's avatar
      arvindyadav
      Icon for Post Partisan rankPost Partisan

      Hi v-xicai ,

       

      Can you please read the Message once again I have made changes. your Dax is not works for me.

      The result I am getting after applying your measure is: