Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
WorkHard
Helper V
Helper V

Create table with specific columns from another table, rename the columns and add a filter criteria

Is it possible to do these three things in the process of creating a table? 

I'm new to DAX and can't decide if I can attack these 3 issues in a single formula.

 

Scenario simplified:

Let's say I have a table called "Projects" with 3 columns: Project ID, Project Name, Start Date.

 

I'd like to:

 1. Create a separate table based on specific columns. So I'd only need the Project Name and Start Date column.

 2. Rename these columns so that instead of it saying Project Name and Start Date, let it say Project, Start

 3. Filter only Projects from >=2020 year. (The date is in the format 1/1/2020)

 

Can I achieve all three in a formula when creating the table?

Here's my attempt:

New Table =
SELECTCOLUMNS (
    "Project", 'Projects'[Project Name],
    "Start", 'Projects'[Start Date],
)

 

How can I apply the filter here? With an IF statement? With Return or some sort of calculation formula?

1 ACCEPTED SOLUTION
FrankAT
Community Champion
Community Champion

Hi,
give this a try:

 

SELECTCOLUMNS(
FILTER(Projects, Projects[Start Date] >= DATE(2020,1,1)),
"Project",Projects[Project Name],
"Start",Projects[Start Date]
)

 

Regards FrankAT

View solution in original post

2 REPLIES 2
Omega
Impactful Individual
Impactful Individual

Hi,

 

You can do the same using Power Query. Try applying the below steps: 

 

1- Click on Edit Query

2- Select the Query/Table you want to replicate

3- Right click on the query and select Reference

4- Manipulate the new query by changing the column names and filter the date

FrankAT
Community Champion
Community Champion

Hi,
give this a try:

 

SELECTCOLUMNS(
FILTER(Projects, Projects[Start Date] >= DATE(2020,1,1)),
"Project",Projects[Project Name],
"Start",Projects[Start Date]
)

 

Regards FrankAT

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.