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
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
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.