Forum Discussion

BobiRussell's avatar
BobiRussell
Frequent Visitor
7 years ago

Calculate Revenue based on Non-Date Function

I have a client who is looking to calculate Gross Revenue for a given month and prior month on the same report. I have used a measure to calculate Gross Revenue and for the prior period I've used the DATEADD, see below. Since the Fiscal Period is different then the calendar period they do not like the Fiscal Date to show 3/1/2019 but would like to change the format or have end user to select a period 2019-03 and automatically calculate the prior period 2019-02 on the same report without Date Function. Since the end user might be confussed and look at the fiscal date and think its March 2019. The Fiscal Period starts Nov. I've reached out to a few other and they don't recommend that I not use the time intelligence built in Power BI. I'm looking for alternative ways to calculate Gross Margin based on another field and then go back another period to show on the same report without using the date function? Any help or direction would be very appreciated. :)

 

 

Gross Revenue LM = CALCULATE(
[Gross Revenue], DATEADD( facts_Transactional[FiscalDate], -1, MONTH ) )
 
 
 Curent PriodPrior PeriodVariance
Gross Revenue $        254,005 $        215,989 $        38,016
Selling Margin $ $        128,485 $        118,285 $        10,200
Selling Margin %50.6%54.8%-4.2%
 

4 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi BobiRussell ,

     

    It seems that you want to calculate the Last Fiscal Period Revenue, you could have a reference of this similar thread firstly.

     

    Try the formula below.

    Previous month Revenue =
    VAR currentFYYear = 'Date'[FYYear]
    VAR currentFiscalMonth = 'Date'[Fiscal Month]
    RETURN
        CALCULATE (
            SUM ( 'Registrations'[Revenue] ),
            FILTER (
                ALL ( 'Date' ),
                'Date'[Fiscal Month] = currentFiscalMonth-1
                    && 'Date'[FYYear]
                    = currentFYYear
            )
        )

    If  you still need help, please share some data sample so that we can understand your scenario better and have test on it.

     

    Best Regards,

    Cherry

    • BobiRussell's avatar
      BobiRussell
      Frequent Visitor

      Hi Cherry,

      Thank you for the DAX Code. Unfortunately, the DAX Code you provided didn’t work because I didn’t give you with table and column names to reference. I have a transaction file name "facts_transactionaltraverse" that columns that I’m using are;

      • Gross Revenue - Measure
      • FiscalYear – Whole number [ie 2019]
      • Fiscal Month – Whole number [ie 8]
      • InvoiceDate – Date [02/08/2019]
      • Fiscal Date - I use this to create a date that I can run time intelligence calculations

      Fiscal Date = CONCATENATE( facts_TransactionalTraverse[FiscalMonth],

          CONCATENATE ("/" ,

          CONCATENATE ("1" ,

          CONCATENATE ("/" , 

          facts_TransactionalTraverse[FiscalYear] ))))

      • Another challenge is that the “Fiscal Month” starts November

      I tried to modify the code you provided but I’m not getting it. I know that I should use the columns in the Date for periods but I was asked to reference the Fiscal Year & Month since their invoice dates don’t always correspond to Fiscal Period. Hope this info is more useful. Maybe I need to create another table?

      Previous Month Revenue =

      VAR currentFYYear = facts_TransactionalTraverse[FiscalYear]

      VAR currentFiscalMonth = facts_TransactionalTraverse[FiscalMonth]

      RETURN

          CALCULATE (

              SUM ( [Gross Revenue]),

              FILTER (

                  ALL ( facts_TransactionalTraverse[Current Period] ),

                  facts_TransactionalTraverse[FiscalMon] = currentFiscalMonth-1

                      && facts_TransactionalTravese[InvoiceDate]

                      = currentFYYear

              )

          )

       

      Thank you again,

      Bobi

      • v-piga-msft's avatar
        v-piga-msft
        Resident Rockstar

        Hi BobiRussell ,

         

        If it is convenient, could you share your data sample with table format and your desired output so that I could have a test on it and understand your requirement more clearly.

         

        Best Regards,

        Cherry