cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
XTF_2020
Helper I
Helper I

Omit columns or pivoted table with dax

I created a table with a SUMARIZE() function,

 

XTF_2020_1-1629809207150.png

 

Is there any way to omit as blank columns(Setembro, Outubro, Novembro, Dezembro) in the view, or else to pivoted this table to filter only the months already filled in?

XTF_2020_3-1629809358416.png

Pivoted Table

XTF_2020_7-1629810011861.png

 

3 REPLIES 3
XTF_2020
Helper I
Helper I

Solved, you can close the topic.
I had done it like this:

Table = 
Var tabela = SUMMARIZE('FATURAMENTO GERAL','FATURAMENTO GERAL'[SETOR],


                        "Janeiro", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 1,  
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),

                        "Fevereiro", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 2, 
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),

                           ...


                        "Dezembro", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 12, 
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),

                        "Média Ano", DIVIDE(CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano,
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros), Mes)  
)

RETURN tabela

And I managed to solve my problem like this:

TABELA RESUMO FATURAMENTO = 

Var jan = SUMMARIZE('FATURAMENTO GERAL','FATURAMENTO GERAL'[SETOR],
                        "Value", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 1,  
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),
                        "Type", "Janeiro", "Ordder_Col", 1)

Var fev = SUMMARIZE('FATURAMENTO GERAL','FATURAMENTO GERAL'[SETOR],
                        "Value", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 2,  
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),
                        "Type", "Fevereiro", "Ordder_Col", 2)

...

Var dez = SUMMARIZE('FATURAMENTO GERAL','FATURAMENTO GERAL'[SETOR],
                        "Value", CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano, 'FATURAMENTO GERAL'[Mes] = 12,  
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros),
                        "Type", "Dezembro", "Ordder_Col", 12) 

var media = SUMMARIZE('FATURAMENTO GERAL','FATURAMENTO GERAL'[SETOR],
                        "Value", DIVIDE(CALCULATE(SUM('FATURAMENTO GERAL'[TOTALRECEITA]), 
                                    'FATURAMENTO GERAL'[Ano] = Ano,
                                    'FATURAMENTO GERAL'[ITEM] IN lista_filtros), Mes),
                        "Type", "Média Ano", "Ordder_Col", 17) 

RETURN UNION(jan, fev, mar, abr, mai, jun, jul, ago, sept, out, nov, dez, av1, av2, ah, total, media)

 

 

amitchandak
Super User
Super User

@XTF_2020 , Create month as rows; not has columns; in your table, then they will not display when they do not have data. In matrix use month on column(pivot)

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Hello @amitchandak ,
In the view I need the table in horizontal format, with the columns being the months, but I wouldn't want to display the months that don't have data.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.