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

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

Reply
Tomas930115
Regular Visitor

Create table from existing one with the condition from the user

Actual =

VAR x = variables[var_2021]
VAR y = variables[var_2022]
VAR z = variables[var_RE]
VAR a = variables[var_BP23]

RETURN
SWITCH(
    TRUE(),
    [User_selection_actual] = variables[var_Slicer_option_Actual_1], CALCULATETABLE(query_all,query_all,query_all[Version]=x),
    [User_selection_actual] = variables[var_Slicer_option_Actual_2], CALCULATETABLE(query_all,query_all,query_all[Version]=y),
    [User_selection_actual] = variables[var_Slicer_option_Actual_3], CALCULATETABLE(query_all,query_all,query_all[Version]=z),
    [User_selection_actual] = variables[var_Slicer_option_Actual_4], CALCULATETABLE(query_all,query_all,query_all[Version]=a),

    "Select"
)
 
Hi, 
 
I am trying to create a new table from the existing table and it should take the condition from the user. So for instance, the user would pick Slicer_option_actual_1 and then it would create a new table that would filter from the old table the correct version of " Slicer_option_actual_1".
 
The error is: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
I have googled this problem but could nto find it for the instance where the condition is based on the user. 
 
Thank you for your help
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Tomas930115 ,

 

If you want a table visual displayed, it could be achieved.

vstephenmsft_0-1669009956769.png

If you want a calculated table created by dax, as @amitchandak  said, it's impossible.

Because calculated tables are static results, results are not dynamically updated because of slicer or filter filtering.

 

 

Best Regards,

Stephen Tao

 

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
amitchandak
Super User
Super User

@Tomas930115 , You can not create a table based on the selected value. As that will not be correct

 

 

For error

This may measure where are using that code

 

or you need a max here

[User_selection_actual] = max(ariables[var_Slicer_option_Actual_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I will illustrate the problem in this example:

 

Original Table:

VersionRevenueProduct
x10 
x10 
x10 
x10 
z20 
z20 
y30 
a40 

 

On PowerBi dashborad, I the user would select "version" for instance -> "x" and the new table would be created only with a rows version "x" 

New table:

VersionRevenueProduct
x10 
x10 
x10 
x10 

 

 

Anonymous
Not applicable

Hi @Tomas930115 ,

 

If you want a table visual displayed, it could be achieved.

vstephenmsft_0-1669009956769.png

If you want a calculated table created by dax, as @amitchandak  said, it's impossible.

Because calculated tables are static results, results are not dynamically updated because of slicer or filter filtering.

 

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.