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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

how to calculate sale amount difference between season of context and previous season?

I am triying to calculate sale amount difference between season of context and previous season.
But I don't know how to solve this problem.

 

Data is below:

 

Fact Table

SaleMonthSeasonSaleAmount
2018-06-01U604
2018-04-01U10
2018-10-01U322
2017-10-01U557
2016-03-02U12
2018-05-01Q49
2018-06-01Q948
2017-04-01Q134
2017-05-01Q427
2016-12-01Q578
2018-06-01R810
2018-06-01R431
2018-06-01R167
2017-12-01R935
2017-11-01R777
2018-08-01W447
2018-08-01W799
2018-07-01W133

 

 

Dimension Table

SeasonSeasonYearCategroy
Q2017S/S
R2017F/W
U2018S/S
W2018F/W

 

  • "W" season's previous season is "R"
  • "U" season's previous season is "Q"

 

I have to call sale amounts about previous season on current context.

I don't call values which are on difference rows.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create relationship as below

2.png

 

Create measures

previous = CALCULATE(SUM(Sheet1[SaleAmount]),FILTER(ALLEXCEPT(Sheet2,Sheet2[Categroy]),[SeasonYear]=MAX([SeasonYear])-1))

diff = SUM(Sheet1[SaleAmount])-[previous]

2.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create relationship as below

2.png

 

Create measures

previous = CALCULATE(SUM(Sheet1[SaleAmount]),FILTER(ALLEXCEPT(Sheet2,Sheet2[Categroy]),[SeasonYear]=MAX([SeasonYear])-1))

diff = SUM(Sheet1[SaleAmount])-[previous]

2.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Actually I want to filter data by season only, not year.

But this solution is good as i filter the [Category].

Thank you very much! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.