cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VladimirRSA
New Member

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
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.