Forum Discussion

Yuiitsu's avatar
Yuiitsu
Icon for Helper V rankHelper V
2 years ago

Month to month comparison

Dear All

Please see if the following can be achieved in powerbi.

(I am unable to attach Powerbi files or box link here so please see a sample table.)

 

#1 Month to month comparision

Every biweekly the sales will amend the forecast for the year, and the results are merged in powerquery.

Below is a simplified sample of how the table looks like after power query merged all the individual files together.

DateBooking AmountBU
11-Jun-24                                        25,641,561CT
11-Jun-24                                              251,548AS
11-Jun-24                                              548,846AS
11-Jun-24                                                25,186AS
11-Jun-24                                              163,845CT
26-Jun-24                                        29,641,961TH
26-Jun-24                                              291,949CT
26-Jun-24                                              949,946AS
26-Jun-24                                                29,196TH
26-Jun-24                                              163,949TH
26-Jun-24                                                99,946AS
26-Jun-24                                              949,946AS
12-Jul-24                                                59,196CT
12-Jul-24                                              163,949TH
12-Jul-24                                        25,641,561AS
12-Jul-24                                                59,196TH
12-Jul-24                                              163,949CT
25-Jul-24                                              949,946TH
25-Jul-24                                                59,196CT
25-Jul-24                                              163,949AS
25-Jul-24                                        25,641,561TH
10-Aug-24                                              949,946CT
10-Aug-24                                                59,196TH
10-Aug-24                                              163,949AS
10-Aug-24                                        25,641,561TH
22-Aug-24                                                52,946TH
22-Aug-24                                              949,346AS
22-Aug-24                                                59,196CT
22-Aug-24                                              163,949CT
22-Aug-24                                        25,645,461CT

 

What I want to do, is to compare month to month what is the increase or decrease in the forecast.

I should use only the SUM of the latest booking amount of the month but

I am not able to do it as Powerbi will SUM the entire month booking amount which is not accurate.
What I want is to take only the sum of the latest date of the month and SUM the total to compare month to month.

 Date  Sum of Booking Amount 
 26-Jun                                 32,126,893
 25-Jul                                 26,814,652
 22-Aug                                 26,870,898

 

 

 

Last Mth_HQ BK Amt = CALCULATE(
    [Total_HQ BK Amt],PARALLELPERIOD('Date_Key'[Date],-1,MONTH))

 

 

This measure will not work. Please help me to see how I can get the result? 

( I also would like to do Year to Year comparison ! It would be helpful if you can also give tips for this)

8 Replies

  • BIswajit_Das's avatar
    BIswajit_Das
    Icon for Impactful Individual rankImpactful Individual

    Hello Yuiitsu 
    Can you Explain it by an example
    like
    what's the data is like and
    what's your required result table look like ..

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi All
    Firstly , BIswajit_Das thank for you solution!
    And Yuiitsu  for your question,as I understand it, you have two requirements, one is to count the sum of the latest date of each month and the second one is to get the sum of the previous month for forecasting.

    We'll start by creating a calculated column to filter the table by year and month to get our latest values for each month.

    LatestDateInMonth = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Date].[Year],'Table'[Date].[Month]))

    And then create a new table to count the sum of them, which will be used to match the visual objects you send out.

    A = SUMMARIZE('Table','Table'[Date],"LatesBookingAmount",
    CALCULATE(SUM('Table'[Booking Amount]),FILTER('Table','Table'[Date]='Table'[LatestDateInMonth])
    )
    )

    Create an index column for each month to get the total value for the previous month.

    Date index = MONTH('A'[Date])
    DaLastMonthBookingAmount = 
    IF(
       CALCULATE(MAX(A[LatesBookingAmount]),FILTER('A','A'[Date index]=EARLIER('A'[Date]))),
     0,
       CALCULATE(MAX(A[LatesBookingAmount]),FILTER(A,'A'[Date index]=EARLIER('A'[Date index])-1)
    ))

    If you have any other questions, you can check the pbix file I uploaded, it might help you to solve the problem.

     

    Hope it helps!

     

    Best regards,


    Community Support Team_ Tom Shen

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

     

     

     

     

    • Yuiitsu's avatar
      Yuiitsu
      Icon for Helper V rankHelper V

      Thank you Anonymous  for your detailed solution.

      I cannot seem to fit it inside my original pbix

      One of the reason I believe could be because my pbix is much more complicated, as I have multiple raw files and I have star schema linking the report month date columns to a date key.

       

      When I tried to create the same column I get this result. 

      It is due to my lack of knowledge and experience I could not apply what you provided for me.

       

      Is it possible or is there any way I could upload my sample pbix here? 

      I believe that would help alot.

       

      And I am so sorry for the lack of information in my question post.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Yuiitsu ,

        I'd like to help you out as soon as possible as well, if you don't know how to upload attachments, here's the document I found for you, I hope it helps to help you out with uploading attachments.

        How to Get Your Question Answered Quickly - Microsoft Fabric Community

        Hope it helps!

         

        Best regards,


        Community Support Team_ Tom Shen

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