Forum Discussion
Create A Slicer
Hi,
I had several Project Nos beginning with year.
Kindly assist on how to create a slicer using the Project Nos
//NT
Well, you didnt ask the right question on the first post.
You will have to create a new column, either by DAX, or in Power Query (which I would recommend). you can use following steps in PQ: Duplicate the column, Split the column by "-" remove the second part and use the first part as the year.
In Dax you can use LEFT function when creating new column.
Kudos and mark as solution appreciated.Step 0: I use your data.
Step 1: I duplicate 'ProjectNr' column on Power Query Editor.
- Before -
- After -
Step 2: I split the 'ProjectNr - Copy' column by '-' delimiter.
- Before -
- After -
Step 3: I rename 2 columns below.
'ProjectNr - Copy.1' --> 'Year'
'ProjectNr - Copy.2' --> 'Nr'
Step 4: I click 'Close & Apply'.
Step 5: I make 2 slicers and a matrix on Power BI Desktop.
- Year -
- ProjectNr -
- Matrix -
6 Replies
- zenisekdSuper User
Hi, simply create a slicer visual and place the field Project Nos there.
https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-slicers?tabs=powerbi-desktop- AnonymousNot applicable
Hi,
I had done what you said and it showed the all project nos as shown. But what I'm trying to get is the slicer will only show the year and the table outline the job nos. do i need to create a new columns if so what dax i need to create?
- zenisekdSuper User
Well, you didnt ask the right question on the first post.
You will have to create a new column, either by DAX, or in Power Query (which I would recommend). you can use following steps in PQ: Duplicate the column, Split the column by "-" remove the second part and use the first part as the year.
In Dax you can use LEFT function when creating new column.
Kudos and mark as solution appreciated.
- ajohnso2Solution Supplier
create a new column
ProjectYear =
MID('Projects'[ProjectNo],1,4)
This will return just the year portion, add this new column as your slicer
- AnonymousNot applicable
do i need to create a new column in power bi or power query?
- mickey64Super User
Step 0: I use your data.
Step 1: I duplicate 'ProjectNr' column on Power Query Editor.
- Before -
- After -
Step 2: I split the 'ProjectNr - Copy' column by '-' delimiter.
- Before -
- After -
Step 3: I rename 2 columns below.
'ProjectNr - Copy.1' --> 'Year'
'ProjectNr - Copy.2' --> 'Nr'
Step 4: I click 'Close & Apply'.
Step 5: I make 2 slicers and a matrix on Power BI Desktop.
- Year -
- ProjectNr -
- Matrix -