Forum Discussion

nithinsakhamuri's avatar
nithinsakhamuri
Frequent Visitor
4 years ago
Solved

Previous Quarter

Dear Team, need some help.   I'm having two different tables Finance and Budgets. There is a relationship between two tables.   Finance Table: As of Date Property Id YTD Revenue Quarter  ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    hi nithinsakhamuri ,

     

    Developed a solution as follows

     

    1. Created a column QtrNumber = Yearfrom (AsofDate) *100 + Quarter in both YTD Revenue and Budget Table.

    This is created to ensure you select the quarter using this column. Otherwise when the year changes there will be issues.

    2. The 2 tbales are not connected.

    3. Create a measure

        

    Budget = 
    var _id = Selectedvalue('YTD Revenue'[Property Id])
    var _qtrNumber = SELECTEDVALUE('YTD Revenue'[QtrNumber])
    var _budQtr = CALCULATE(MAX(Budget[QtrNumber]), Budget[QtrNumber] <= _qtrNumber && Budget[Property Id] = _id) 
                               // Get Max QtrNumber from Budget table for the propertyid 
    var Result = CALCULATE(MAX(Budget[Budget Revenue]), Budget[QtrNumber] = _budQtr && Budget[Property Id] = _id) 
                             //Get the corresponding Budget 
    Return
    Result

     4. Create a slicer using YTD Revenue - QtrNumber

    5. Create a Table visual with values as AsofDate, PropertyID, Quarter, Revenue, Budget ( measure created above)

     

    Check it out.

     

    If it works please accpet it as Solution and also give Kudos.

     

    Cheers

     

    CheenuSing