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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Filters not changing Figures based on DAX Calculated Tables

I am hoping someone can help me.  I needed to perform a transpose function (Columns to Rows) and managed to do so via DAX through the use of UNION and ROW functions.

 

Commentary = UNION(
ROW("Attribute","Total Sales","Amount",[Ttl Sales]),
ROW("Attribute","Costs","Amount",-[Ttl Costs]),
ROW("Attribute","Profit","Amount",[Ttl Profit]))
 

Now, I now have the difficulty of the figures not changing when the slicer is activated, as shown below

 

example.png

Cheers in advance

Pingi

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649725808521.png

Calculated tables, as in Modeling/New Table/Type stuff in dax, is a "static" table.  It will not respond to filters.

You can create a table to contain Total Sales, Costs, Profit, and be affected by slicers by creating measures.

Here are the steps you can follow:

1. Use Enter to create a table

vyangliumsft_1-1649725808524.png

2. Create measure.

Ttl Sales = SUMX(ALLSELECTED('Main Table'),'Main Table'[AMOUNT])
Ttl Costs =
var _min=MINX(ALLSELECTED('Main Table'),[Date])
var _max=MAXX(ALLSELECTED('Main Table'),[Date])
return
SUMX(FILTER(ALL('Main Table'),'Main Table'[Group]="A"&&'Main Table'[Date]>=_min&&'Main Table'[Date]<=_max),[AMOUNT])
Ttl Profit =
var _min=MINX(ALLSELECTED('Main Table'),[Date])
var _max=MAXX(ALLSELECTED('Main Table'),[Date])
return
SUMX(FILTER(ALL('Main Table'),'Main Table'[Group]="B"&&'Main Table'[Date]>=_min&&'Main Table'[Date]<=_max),[AMOUNT])
Measure =
SWITCH(
    TRUE(),
    MAX('Slice'[Attribute])="Total Sales",[Ttl Sales],
    MAX('Slice'[Attribute])="Costs",[Ttl Costs],
    MAX('Slice'[Attribute])="Profit",[Ttl Profit])

3. Result:

vyangliumsft_2-1649725808527.png

Please click here for the pbix file

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649725808521.png

Calculated tables, as in Modeling/New Table/Type stuff in dax, is a "static" table.  It will not respond to filters.

You can create a table to contain Total Sales, Costs, Profit, and be affected by slicers by creating measures.

Here are the steps you can follow:

1. Use Enter to create a table

vyangliumsft_1-1649725808524.png

2. Create measure.

Ttl Sales = SUMX(ALLSELECTED('Main Table'),'Main Table'[AMOUNT])
Ttl Costs =
var _min=MINX(ALLSELECTED('Main Table'),[Date])
var _max=MAXX(ALLSELECTED('Main Table'),[Date])
return
SUMX(FILTER(ALL('Main Table'),'Main Table'[Group]="A"&&'Main Table'[Date]>=_min&&'Main Table'[Date]<=_max),[AMOUNT])
Ttl Profit =
var _min=MINX(ALLSELECTED('Main Table'),[Date])
var _max=MAXX(ALLSELECTED('Main Table'),[Date])
return
SUMX(FILTER(ALL('Main Table'),'Main Table'[Group]="B"&&'Main Table'[Date]>=_min&&'Main Table'[Date]<=_max),[AMOUNT])
Measure =
SWITCH(
    TRUE(),
    MAX('Slice'[Attribute])="Total Sales",[Ttl Sales],
    MAX('Slice'[Attribute])="Costs",[Ttl Costs],
    MAX('Slice'[Attribute])="Profit",[Ttl Profit])

3. Result:

vyangliumsft_2-1649725808527.png

Please click here for the pbix file

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@Anonymous , This is a new table and will not take filter from the old table. My advice would create a calculation group.

 

Matrix - Show on Row can also help without change

 

or consider calculation group - Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0 

 

calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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