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
Anonymous
Not applicable

SELECTCOLUMNS performs wrong calculation on some tables

Hi All,

I am getting crazy by a weird behaviour of SELECTCOLUMNS with some - but not all - tables in my dataset.
Since I need to split my data on a yearly basis, I use SC to create a new table with just required columns.
The problem is that same formula produces different outcomes:
- in some cases, values are entered in respective columns (2020 values in 2020 col, 2021 values in 2021 col, and so on)

- in other cases, the same formula has sum up all values of respective years, then populated the new table with these totals

 

For sure I am doing something wrong, but I just can't figure out where...

 

Many thanks in advance to whose can provide any help/hint.

 

expected outcomeexpected outcomeweird behaviourweird behaviour

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi All,

 

for all those interested, root cause and solution of the issue can be found in this post: Same Formula applied on identical Tables gives different outcome 

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi All,

 

for all those interested, root cause and solution of the issue can be found in this post: Same Formula applied on identical Tables gives different outcome 

 

 

amitchandak
Super User
Super User

@Anonymous , Use summarize

example

 

summarize(Table, Table[Date], "2020", calculate(sum(Table[Value]), filter(Table, Table[Year] =2020) )
, "2021", calculate(sum(Table[Value]), filter(Table, Table[Year] =2021) )
, "2022", calculate(sum(Table[Value]), filter(Table, Table[Year] =2022) ))

Anonymous
Not applicable

@amitchandak

thanks for your reply; however, though your solution works for different purposes, I don't need the years' totals but all the rows for the same period (see picture 'expected outcome').

In addition, please note that the same logic works with some tables but not with others, so I wonder whether the problem is not in which formula is going to use but in the data/table; here is were I am getting lost.

not the expected resultnot the expected result

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.