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
Matteoss
Regular Visitor

Revenues variable

Hi there, 

 

I have a model with three fact tables "Importi_2020" "Importi_2021" and "Importi_2022" all linked to a Calendar table. 

I need to implement a "Revenue Variable" that changes its value according to the year. 

I cannot merge the tables because they have different relationships with other dimension tables.

The output should allow me to have on the same timeline the value of Revenue from 2020 to 2022 using just the Revenue Variable..

I know it is not so difficult but I get in trouble using IF clause with Year of the calendar table 

 

Appreciate your help, 

Matteo 

3 REPLIES 3
Matteoss
Regular Visitor

Thanks for your fast reply, 

 

I try to explain i little better what is my issue. 

It is like i have three sales tables one for each year (2020, 2021, 2022). I cannot append them since they have been implemented differently. What is the same is the final value of total sales for each month. 

I think the solution could be related to a variable that give me as output the correct sales amount linked to the three tables according to the year. 

I do not think the measures you give me can work in my case. 

Sound it reasonable for you? 

 

Hi, @Matteoss 

 

Can you provide some sample data or simple pbix files? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.

 

Best Regards,

Community Support Team _Charlotte

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

amitchandak
Super User
Super User

@Matteoss , You should append (union) if possible. else create this year ve last year measure on two different table 

 

example

 

YTD Sales = CALCULATE(SUM(Importi_2021[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

 

 

 

other example measures are

 

This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

Last YTD Sales = CALCULATE(SUM(Importi_2020[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.