cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jlarques Frequent Visitor
Frequent Visitor

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
Community Support Team
Community Support Team

Re: Create new table depending on what the user chooses

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.

jlarques Frequent Visitor
Frequent Visitor

Re: Create new table depending on what the user chooses

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

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 6 members 1,113 guests
Please welcome our newest community members: