Forum Discussion
Create new column based on a calculated one
Good
I am trying to create a column that gives me the most repeated value for a certain value. For this I have made a Count column, where I calculate how much the value is repeated.
I need to fill in the column name + repeated, with the name that is repeated the most for each code.
Thank you!
Hi Syndicate_Admin ,
try this column
Column = VAR _MaxCount = MAXX( FILTER( 'Table', 'Table'[Code] = EARLIER('Table'[Code]) ), 'Table'[Count] ) RETURN SELECTCOLUMNS( FILTER( 'Table', 'Table'[Code] = EARLIER('Table'[Code]) && 'Table'[Count] = _MaxCount ), "Nombre",[Nombre] )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Syndicate_Admin ,
You can try this method:
Name + repeated = VAR _max = CALCULATE ( MAX ( 'Table'[Count] ), ALLEXCEPT ( 'Table', 'Table'[Code] ) ) RETURN CALCULATE ( MAX ( 'Table'[Number] ), FILTER ( 'Table', 'Table'[Count] = _max ) )The result is:
Hope this helps you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- amitchandak
Super User
Syndicate_Admin , The information you have provided is not making the problem clear to me. Can you please explain with an example.
Appreciate your Kudos.- Syndicate_Admin
Administrator
Good
I have prepared a table to try to explain it. I want the column "name + repeated" to take the value of "Name" that is repeated more times for a code.
That is, for Code MI-0876 that has three entries, put the value of Peter.
Code Count Number Name + repeated MI-0876 10 Louis Pedro MI-0876 20 Pedro Pedro MI-0876 5 Antonio Sedro MU-098 1 Sofia Sofia MU-0781 4 Alejandra Alejandra thanks and greetings
- mangaus1111
Solution Sage
Hi Syndicate_Admin ,
try this column
Column = VAR _MaxCount = MAXX( FILTER( 'Table', 'Table'[Code] = EARLIER('Table'[Code]) ), 'Table'[Count] ) RETURN SELECTCOLUMNS( FILTER( 'Table', 'Table'[Code] = EARLIER('Table'[Code]) && 'Table'[Count] = _MaxCount ), "Nombre",[Nombre] )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- mangaus1111
Solution Sage
Hi Syndicate_Admin ,
try with this calculated column
Column = VAR _MaxCount = MAX('Table'[Count]) RETURN SELECTCOLUMNS( FILTER( 'Table', 'Table'[Count] = _MaxCount ), "Nombre",[Nombre] )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.