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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ww1711
Frequent Visitor

Calculated Table using SELECTEDVALUE

Hi all,

 

This should be simple enough, but I can't get it to work... I've got Table A and Table B that share the same schema. I want to inspect a slicer (that chooses between 2 values in a separate table) and return either Table A or Table B as the definition of calculated table C.

 

Essentially, something like (pseudocode): 

  • if slicerSelection == Value A
    • return Table A
  • else
    • return Table B

I want the above to be the defintion of "Table C", so that I may assign it to a Matrix and the user can easily swap between table A and table B. I understand this kind of thing can be accomplished with bookmarks (hiding/showing based-on button clicks), but I'd rather do it with the above logic if possible.

 

Thank you!

1 ACCEPTED SOLUTION
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @ww1711 ,

Unfortunately, a Calculated Table is evaluated upon refresh of the datamodel. Thus selecting a slicervalue doesn't return a new evaluated calculated table.

What might be a solution to your problem is to merge both table A and B in total with an additional column "SourceTable" that has value A for all rows that come from Table A and has value B for all rows from Table B. This then can be Table C. If you put the column "SourceTable" in the slicer, you can have filtered contexts of Table C in the matrix.

 

Hope this explanation makes sense, if not please let me know!

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @ww1711 ,

 

the calculated table would look something like this.

Table C =
UNION (
    ADDCOLUMNS ( Table A, "Source", "Table A" ),
    ADDCOLUMNS ( Table B, "Source", "Table B" )
)

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @ww1711 ,

Unfortunately, a Calculated Table is evaluated upon refresh of the datamodel. Thus selecting a slicervalue doesn't return a new evaluated calculated table.

What might be a solution to your problem is to merge both table A and B in total with an additional column "SourceTable" that has value A for all rows that come from Table A and has value B for all rows from Table B. This then can be Table C. If you put the column "SourceTable" in the slicer, you can have filtered contexts of Table C in the matrix.

 

Hope this explanation makes sense, if not please let me know!

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Lol Power BI strikes out again

Hey @ww1711 ,

 

next to @JarroVGIT suggested it's also important to know, that the DAX formula can not return a table object or a column object.
This is one of the reasons (but not the most important one) why it's simply not possible to swap the axis of a visual or the row/column headers of a table or matrix visual.

So, it's necessary to have a column that contains all the possible values and create a measure that "maps" the values from the source tables in accordance with the selections made by the user.

The most simple way is to merge the tables as suggested by @JarroVGIT and "typed" by @mwegener.

 

Regards,

Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.