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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
SikY
New Member

data modeling

Hi everyone

 

I'm facing a big difficulty in data modeling. Wish someone could help me.

 

Let's say, in Table 1 below, SOP refers to the start date of production, life cycle refers to the number of years in which profits start, and revenue is the annual income that the project will earn in subsequent years

Table1:

SOPLife CycleRevenue
2024/5      4100
2022/5      3200
2025/5      4300
2023/5      5400

 

What I want to achieve is to calculate the total annual revenue for the next ten years, as shown in Table 2, and finally show the stacked bar chart

Table 2:

 2022202320242025202620272028202920302031
Annual Revenue200600700800800800300   

 

Any suggestion is appreciated!

Nelson

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @SikY 

 

You can try the following methods.

Table:

Table 2 = 
var _a = GENERATESERIES(year(MIN('Table 1'[SOP])),year(MAX('Table 1'[SOP]))+MAX('Table 1'[Life Cycle]))
var _b = CROSSJOIN(_a,'Table 1')
return
FILTER(_b,[Value]>=[SOP].[Year]&&[Value]<=[SOP].[Year]+[Life Cycle]-1)

vzhangti_0-1654067907029.png

Measure:

Annual Revenue = 
CALCULATE(SUM('Table 2'[Revenue]),FILTER(ALL('Table 2'),[Value]=SELECTEDVALUE('Table 2'[Value])))

vzhangti_2-1654068058997.png

Is this the output you expect?

 

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.

 

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @SikY 

 

You can try the following methods.

Table:

Table 2 = 
var _a = GENERATESERIES(year(MIN('Table 1'[SOP])),year(MAX('Table 1'[SOP]))+MAX('Table 1'[Life Cycle]))
var _b = CROSSJOIN(_a,'Table 1')
return
FILTER(_b,[Value]>=[SOP].[Year]&&[Value]<=[SOP].[Year]+[Life Cycle]-1)

vzhangti_0-1654067907029.png

Measure:

Annual Revenue = 
CALCULATE(SUM('Table 2'[Revenue]),FILTER(ALL('Table 2'),[Value]=SELECTEDVALUE('Table 2'[Value])))

vzhangti_2-1654068058997.png

Is this the output you expect?

 

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.

 

Thanks! It works like a charm!

amitchandak
Super User
Super User

@SikY , First create a new column , in table 1
year = left([SOP],4) *1

 

then a new table  

filter(generate(Table1, generateseries(Min(Table[Life Cycle]), max(Table[Life Cycle]),1)), [Value]>= [year] && [Value] <= [Year] + [Life Cycle])

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.