Forum Discussion

Idkpowerbi's avatar
Idkpowerbi
Helper I
3 years ago

Sharing values between parameter tables

 

EDIT: Sorry about the tables, I m posting from my phone so the tables look whacky after posting. The quality and production tables each have 3 columns, date, production/quality, production_plan/quality_plan. 

 

 

Production_parameters = {("Production",1),("Production_plan",1),("Production",2),("Production_plan",2)}



Measure_production = SWITCH(MAX('parameters'[value1]),"Production",SUM('Factory1'[Produced]),

"Production_plan",SUM('Factory1'[Production_plan]),"Production",SUM('Factory2'[Produced]),

"Production_plan",SUM('Factory2'[Production_plan]))



Quality_parameters = {("Quality",1),("Quality_plan",1),("Quality",2),("Quality_plan",2)}



Measure_quality = SWITCH(MAX('parameters'[value1]),"Quality",SUM('Factory1'[Quality]),

"Quality_plan",SUM('Factory1'[Quality_plan]),"Quality",SUM('Factory2'[Quality]),

"Quality_plan",SUM('Factory2'[Quality_plan]))

 

 

 

 

I wrote the above dax to create a parameter table(which I use for filtering visuals). Found it on a video introducing field parameters. 

 

The above code should create parameter tables as shown below. So now I have two parameter tables and they have two columns each value1 and value2 defaultly named so.

 

Value1Value2
Production1
Prodution_plan1
Production2
Production_plan2

 

As you would have seen the value 2 table is what I use for filtering(between 1 and 2). I also filter between plan and the actual values. So that demands me to have two parameter tables. Is there a way to share this value 2 between the two parameter tables so that I can  have a single filter for 1 and 2  and the quality and production filters are separate. It's very important that I have separate parameter tables. 

 

Also Attaching sample data. Thanks in advance. 

This is table for quality table for factory 1, similar can be assumed for factory 2.

 

Date    quality quality_plan
4/1/2023   6082
4/2/2023   7084
4/3/2023   6580

 

 

 

This for production table for factory 1(corresponding to filter 1) similar data for factory 2

Date    productionproduction_plan
4/1/2023    22612307
4/2/2023    23812307
4/3/2023    2467

2307

4 Replies

  • That's not how you normally define DATATABLE()  but hey, it works, sort of.

     

    Since both your new tables have a column "Value2" you could create another table with that column, call it a dimension, and control both parameter tables from it ...  Of course the names don't matter but the idea would be the same - have a dimension table control the field parameter tables.

    • Idkpowerbi's avatar
      Idkpowerbi
      Helper I

      Can you show me how the new dimension table looks like? Also I am not sure how to control the parameter tables. Do I need to make relationships between the new table and parameter tables?

      If this doesn't make sense 😞 please elaborate on your previous reply. Thanks for reading my question.