Forum Discussion
Create A Slicer
- 2 years ago
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. - 2 years ago
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 -
create a new column
ProjectYear =
MID('Projects'[ProjectNo],1,4)
This will return just the year portion, add this new column as your slicer
do i need to create a new column in power bi or power query?