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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.