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
FZOU
Helper IV
Helper IV

Calculated Column

Hi everyone,

I want to create a column named "NEW" from column "OLD" like the picture below! the rules are to take same values from OLD to NEW but with adding new values that group


-If "OLD" begins with A*, then we will have an additional selection as "A" showing all A* . We need to keep each A  as a selection  also !

EXP : 
(A/CAR, A/BUS, A/TRAIN)==>A
(B/CAR, B/BUS, B/TRAIN)==>B
....
The screenshot below could help you understand what i need to do.

-to resume i want to get the column with the name "NEW",i hope this could helpCapture.PNG

Thank you for your help !

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @FZOU ,

 

According to my undertanding, you want to display all rows beginning with the first letter of the selected value in slicer, right?

 

As mentioned above, after creating a new table, please try the following measure:

 

 

Measure =
IF (
    LEFT ( MAX ( 'Table'[OLD] ), 1 )
        = LEFT ( SELECTEDVALUE ( 'New Table'[New] ), 1 ),
    1,
    0
)

 

 

And apply it to visual-filter pane, set as "=1" like this:

2.23.5.1.gif

Here is the pbix file.

 

Best Regards,
Eyelyn Qin
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

7 REPLIES 7
v-eqin-msft
Community Support
Community Support

Hi @FZOU ,

 


Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @FZOU ,

 

According to my undertanding, you want to display all rows beginning with the first letter of the selected value in slicer, right?

 

As mentioned above, after creating a new table, please try the following measure:

 

 

Measure =
IF (
    LEFT ( MAX ( 'Table'[OLD] ), 1 )
        = LEFT ( SELECTEDVALUE ( 'New Table'[New] ), 1 ),
    1,
    0
)

 

 

And apply it to visual-filter pane, set as "=1" like this:

2.23.5.1.gif

Here is the pbix file.

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-eqin-msft
Community Support
Community Support

Hi @FZOU ,

 

Please use the following formula to create a calculated table:

New Table =
VAR t1 =
    DISTINCT ( SELECTCOLUMNS ( 'Table', "New", LEFT ( [OLD], 1 ) ) )
VAR t2 =
    DISTINCT ( SELECTCOLUMNS ( 'Table', "New", 'Table'[OLD] ) )
RETURN
    ADDCOLUMNS (
        UNION ( t1, t2 ),
        "OLD", LOOKUPVALUE ( 'Table'[OLD], 'Table'[OLD], [New] )
    )

The final output is shown below:

2.19.1.PNG

Here is the pbix file.

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-eqin-msft ,thank you for your help,but it didn't do the main goal, because if i use NEW as a slicer and select A, in the other hand a table with OLD  it should display all OLD who start with A, you find below an exemple:
Thank you !Capture.PNG

parry2k
Super User
Super User

@FZOU you need to create a new calculated table, you cannot add rows to the existing table. Let me know if that will work for you. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

FZOU
Helper IV
Helper IV

Hi @parry2k , i want to create the column named "NEW" based on the column named "OLD" on the picture above !
-If "OLD" begins with A*, then we will have an additional selection as "A" showing all A* . We need to keep each A  as a selection  also !

-to resume i want to get the column with the name "NEW",i hope this could help


parry2k
Super User
Super User

@FZOU not really clear what you are looking for, can you provide more details.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.