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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Pietro_Andora
Regular Visitor

Summ of Total Value from a YEAR in a MATRIX

Hello everyone!

 

I have been trying to make this come alive in power bi.

The total value is actually the sum of receits minus debts from the year 2021. But trought measures Im not being able to sum and subract only the values of 2021, and as there is a myriad of other values inside the total summ of 2021, I have been trying to find anoter solution to this case, that is today made in excel. Does anyone have some kind of answer?

 

Any help is appreciated.

Pietro_Andora_1-1654892737489.png

 

 

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

Hi  @Pietro_Andora ,

I created some data:

vyangliumsft_0-1655085318361.png

Here are the steps you can follow:

1. Create calculated column.

Month = FORMAT('Date'[Date],"mmmm")

2. Create measure.

Measure =
IF(
    HASONEVALUE('Date'[Group]),
    SUMX(FILTER(ALL('Date'),'Date'[Group]=MAX('Date'[Group])&& MONTH('Date'[Date])=MONTH(MAX('Date'[Date]))),[Amount]),
SUMX(FILTER(ALL('Date'),YEAR('Date'[Date])=2021&&MONTH('Date'[Date])=MONTH(MAX('Date'[Date]))),[Amount])
    )
Total is correct =
var _table=SUMMARIZE('Date','Date'[Month],"_value",[Measure])
return
IF(HASONEVALUE('Date'[Month]),[Measure],SUMX(_table,[_value]))

3. Result:

vyangliumsft_1-1655085318364.png

 

Best Regards,

Liu Yang

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @Pietro_Andora ,

I created some data:

vyangliumsft_0-1655085318361.png

Here are the steps you can follow:

1. Create calculated column.

Month = FORMAT('Date'[Date],"mmmm")

2. Create measure.

Measure =
IF(
    HASONEVALUE('Date'[Group]),
    SUMX(FILTER(ALL('Date'),'Date'[Group]=MAX('Date'[Group])&& MONTH('Date'[Date])=MONTH(MAX('Date'[Date]))),[Amount]),
SUMX(FILTER(ALL('Date'),YEAR('Date'[Date])=2021&&MONTH('Date'[Date])=MONTH(MAX('Date'[Date]))),[Amount])
    )
Total is correct =
var _table=SUMMARIZE('Date','Date'[Month],"_value",[Measure])
return
IF(HASONEVALUE('Date'[Month]),[Measure],SUMX(_table,[_value]))

3. Result:

vyangliumsft_1-1655085318364.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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