Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Help with Last Quarter Formula

I calculated the sum for last quarter and last quarter previous year but they only work when I plot them against a time period.

I am trying to plot it against customer name instead and the measures just return blanks.

My data has sums of activity by quarterly dates only, not daily. 

These are my measures that are working but only if plotted against date logic.

Net Added Last Quarter = CALCULATE(SUM(OWSSummaryByQuarterByEU[channel_licenses_net_added]), PREVIOUSQUARTER(OWSSummaryByQuarterByEu[End of Quarter].[Date]))
Net Added Last Quarter Prior Year = CALCULATE([Net Added Last Quarter], SAMEPERIODLASTYEAR(OWSSummaryByQuarterByEU[End of Quarter].[Date]))
 
Does anyone have a formula that would give me the sum of last quarter when not plotted against time?
I'm assuming it needs to be a calculated column but everything I try is returning blank or error. 
Willing to try DAX or Power Query solutions.  

7 Replies

  • Hi,

    I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

    I tried to use INDEX DAX function in the measure.

     

    INDEX function (DAX) - DAX | Microsoft Learn

     

     

     

     

    Latest YearQuarter Sales: =
    VAR _latestquarter =
        INDEX (
            1,
            FILTER (
                ALL ( 'calendar'[Year-Quarter] ),
                CALCULATE ( SUM ( sales[sales] ) ) <> BLANK ()
            ),
            ORDERBY ( 'calendar'[Year-Quarter], DESC )
        )
    RETURN
        CALCULATE (
            SUM ( sales[sales] ),
            KEEPFILTERS ( 'calendar'[Year-Quarter] = _latestquarter )
        )
    

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Using the above gives me the error "A Circular Dependency was detected"

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi,

        Thank you for your reply, and please share your sample pbix file's link here, and then I can try to look into it.

        Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Vinay Pabbu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous,

       

      May I ask if you have gotten this issue resolved?

      If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

       

      Regards,
      Vinay Pabbu

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi @CiaraCaryl,

         

        As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
        If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

         

        Regards,
        Vinay Pabbu