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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jlarques
Helper V
Helper V

Create new table depending on what the user chooses

Dear community,

 

I have a main table with many columns and countries. Depending on the country chosen by the user in a slicer, I have to calculate a new table with more or fewer columns that I have to show them. 

 

I tried this formula but this error message appears:

"A SELECTEDCOLUMNS function was used in a True/false expression, which is used as a table filter expression, which is not allowed".

The formula is this:

NewTable =
CALCULATETABLE(
        'P O DATA MASTER';
            IF(
                SELECTEDVALUE(COUNTRIES[COUNTRY])="CAPE VERDE";
                SELECTCOLUMNS('P O DATA MASTER';"COUNTRY"; 'P O DATA MASTER'[COUNTRY]; "SERIAL"; 'P O DATA                  MASTER'[SERIAL]; "PO DATE"; 'P O DATA MASTER'[PO DATE];"DTA"; 'P O DATA MASTER'[DTA];"SKU";'P O                  DATA MASTER'[SKU]; "QUANTITY"; 'P O DATA MASTER'[QUANTITY]; "ESTIMATED EXW DATE";'P O DATA                    MASTER'[ESTIMATED EXW DATE]
               );
          IF(
             SELECTEDVALUE(COUNTRIES[COUNTRY])="CAPE VERDE";
            SELECTCOLUMNS('P O DATA MASTER';"COUNTRY"; 'P O DATA MASTER'[PO DATE];"DTA"; 'P O DATA                          MASTER'[DTA];"SKU";'P O DATA MASTER'[SKU]; "QUANTITY"; 'P O DATA MASTER'[QUANTITY]
           )
      )
  )
)
 
Any idea to solve this situation? 
 
Thanks to everyone for your help!!
 
Regards,
 
 
José Luis
2 REPLIES 2
jlarques
Helper V
Helper V

Hi @v-xuding-msft ,

I have a main table with all data and columns from all countries as you can see in the picture below(in this picture there are only some columns). I have a slicer with all countries and due not all countries have the same information, my idea is to calculate a table with the right columns of each country when the user chooses it. 

Data master.png

As you can see in the next picture, in this case, there is no information on most of the columns, so I want to show only the columns with information.

Países.png

Please, tell me if you need any kind of clarification.

Thanks for your help @v-xuding-msft 

Regards,

 

Jose Luis

v-xuding-msft
Community Support
Community Support

Hi @jlarques ,

Can you please post a dummy file? If you can't , please post some sample data and the expected result. For the current scenario, I can't understand clearly.

 

How to Get Your Question Answered Quickly

 

Best Regards,

Xue Ding

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

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI 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.

Top Solution Authors
Top Kudoed Authors