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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Passing a calculated table column name as parameter

I have a table on my data model with time information starting in 2022, that has estimated times for every month in for every different type of task. The columns are as follows in the dummy example:

DaxLearner78_0-1707245438550.png

It continues with the months until the present.
How
can I extract the information of the time regarding a paricular month of a certain year for one task type?

I already have slicers for month, year and task type and I was trying the following measure:

EstimatedTime =
VAR SelectedMonth = SELECTEDVALUE('DateTable'[Month])
VAR SelectedYear = SELECTEDVALUE('DateTable'[Year])
VAR SelectedTaskType = SELECTEDVALUE('TimeTable'[TaskType])
VAR ColumnName = FORMAT(DATE(SelectedYear, SelectedMonth, 1), "dd/mm/yyyy")
RETURN
SELECTCOLUMNS(
                             FILTER(TimeTable, TimeTable[TaskType] = SelectedTaskType),
                            ColumnName )

My issue is that I am unable to pass the calculated ColumnName as a variable in SELECTCOLUMNS.

Can somebody help/suggest another approach?

Thanks in advance! ๐Ÿ™‚

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

@lbendlin  has provided you with ideas to solve the problem. I have created an example for you based on him and you can follow the steps below:
1. You need to go to Power Query, select Task Type and then click on Unpivot other columns.

vyifanwmsft_1-1707273975291.png

2. Add measure.

EstimatedTime = 
VAR SelectedMonth =
    SELECTEDVALUE ( DateTable[Month] )
VAR SelectedYear =
    SELECTEDVALUE ( DateTable[Year] )
VAR SelectedTaskType =
    SELECTEDVALUE ( TimeTable[Task Type] )
VAR ColumnName =
    FORMAT ( DATE ( SelectedYear, SelectedMonth, 1 ), "dd/mm/yyyy" )
RETURN
    SELECTCOLUMNS (
        FILTER ( TimeTable, TimeTable[Task Type] = SelectedTaskType ),
        "EstimatedTime", ColumnName
    )

 

Final output:

vyifanwmsft_2-1707274358639.png

vyifanwmsft_3-1707274426029.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

3 REPLIES 3
lbendlin
Super User
Super User

You need to start earlier.  In Power Query unpivot your data to bring it into a usable format.

Anonymous
Not applicable

Hi @Anonymous ,

@lbendlin  has provided you with ideas to solve the problem. I have created an example for you based on him and you can follow the steps below:
1. You need to go to Power Query, select Task Type and then click on Unpivot other columns.

vyifanwmsft_1-1707273975291.png

2. Add measure.

EstimatedTime = 
VAR SelectedMonth =
    SELECTEDVALUE ( DateTable[Month] )
VAR SelectedYear =
    SELECTEDVALUE ( DateTable[Year] )
VAR SelectedTaskType =
    SELECTEDVALUE ( TimeTable[Task Type] )
VAR ColumnName =
    FORMAT ( DATE ( SelectedYear, SelectedMonth, 1 ), "dd/mm/yyyy" )
RETURN
    SELECTCOLUMNS (
        FILTER ( TimeTable, TimeTable[Task Type] = SelectedTaskType ),
        "EstimatedTime", ColumnName
    )

 

Final output:

vyifanwmsft_2-1707274358639.png

vyifanwmsft_3-1707274426029.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

 

Anonymous
Not applicable

I really should have pivoted those month columns

Thank you all for the support ๐Ÿ™‚

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (25)