Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nithinsakhamuri
Frequent Visitor

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 DateProperty IdYTD RevenueQuarter 
3/31/211$5,0001
6/30/211$6,0002
3/31/212$7,0001
6/30/212$8,0002

 

Budgets:

As of DateProperty IdBudget RevenueQuarter 
3/31/211$10,0001
6/30/211$10,0002
3/31/212$11,0001

The business doesn't want to enter the data if the Budget Revenue is same as the last quarter.

 

There is a quarter slicer on the page and I'm using Finance[Quarter]. Let's say I'm selecting 2nd quarter and there is no quarter 2 data for the property id 2 on the Budgets table and in this case we have to show Budget Revenue from last quarter i.e 3/31/2021($11,000).

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @nithinsakhamuri ,

 

The solution suggested will take the latest last quarter as Budget.

 

 

Anonymous
Not applicable

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.