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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
VladimirRSA
Regular Visitor

Suamtoria en de columnas en filas

Hola amigos me pueden ayudar a llenar la siguiente tabla en power BI, la tabla la tengo de la siguiente manera

VladimirRSA_1-1665015065298.png

 

 

Pero necesito una sumatoria por fila de cada mes, algo asi

VladimirRSA_2-1665015065305.png

 

 

Alguien podría explicarme como se hace, llevo 3 dias buscándolo 😞

 

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

Hi @VladimirRSA ,

 

This is my test table:

vyadongfmsft_0-1665125053459.png

 

Unpivot other columns in Power Query:

vyadongfmsft_1-1665127358196.png

 

Then you will get a table like this:

vyadongfmsft_2-1665127420262.png

 

Create two new columns:

MonthNumber = SWITCH(
    TRUE(),
    'Table'[Attribute] = "January",1,
    'Table'[Attribute] = "Februray",2,
    'Table'[Attribute]= "March",3,
    'Table'[Attribute] = "April",4,
    'Table'[Attribute] = "May",5
)

SumValue = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Attribute] = EARLIER('Table'[Attribute])))

 

Did you want to create a table visual?

vyadongfmsft_3-1665127546934.png

 

Or create a new table?

 

If you want to create a new table, please try following DAX:

NewTable = VALUES('Table'[MonthNumber])

Month = LOOKUPVALUE('Table'[Attribute],'Table'[MonthNumber],'NewTable'[MonthNumber])

Total = LOOKUPVALUE('Table'[SumValue],'Table'[MonthNumber],'NewTable'[MonthNumber])

 

You will get a new table like this:

vyadongfmsft_4-1665127710203.png

 

Best regards,

Yadong Fang

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-yadongf-msft
Community Support
Community Support

Hi @VladimirRSA ,

 

This is my test table:

vyadongfmsft_0-1665125053459.png

 

Unpivot other columns in Power Query:

vyadongfmsft_1-1665127358196.png

 

Then you will get a table like this:

vyadongfmsft_2-1665127420262.png

 

Create two new columns:

MonthNumber = SWITCH(
    TRUE(),
    'Table'[Attribute] = "January",1,
    'Table'[Attribute] = "Februray",2,
    'Table'[Attribute]= "March",3,
    'Table'[Attribute] = "April",4,
    'Table'[Attribute] = "May",5
)

SumValue = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Attribute] = EARLIER('Table'[Attribute])))

 

Did you want to create a table visual?

vyadongfmsft_3-1665127546934.png

 

Or create a new table?

 

If you want to create a new table, please try following DAX:

NewTable = VALUES('Table'[MonthNumber])

Month = LOOKUPVALUE('Table'[Attribute],'Table'[MonthNumber],'NewTable'[MonthNumber])

Total = LOOKUPVALUE('Table'[SumValue],'Table'[MonthNumber],'NewTable'[MonthNumber])

 

You will get a new table like this:

vyadongfmsft_4-1665127710203.png

 

Best regards,

Yadong Fang

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

Thank you very much it was very useful 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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