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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jlarques
Resolver I
Resolver I

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
Resolver I
Resolver I

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors