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
Anonymous
Not applicable

Calculate a new table with filters from itself

Hi everyone, can anybody help me?

 

I'm working on a stock negotiation report to help to generate info that is usefull for calculating incoming tax from the operations.

 

I have a table that registers all the operations ('Extrato de negociacoes - ANA').

Also, I have a DateTable (marked as date table) that is related to 'Extrato de negociacoes - ANA' by the date field.

 

What I have by now:

1. A slicer conected to the date field of DateTable;

2. A table visual with a visual level filter set to filter the 'Extrato de negociacoes - ANA' values that only registers sales operations ('Extrato de negociacoes - ANA[C/V]' = "V"). 

 

What I need: to create a second table visual that shows me all the operations (buy and sales) of a selected item on the table visual mentioned above (filter the table 'extrato de negociacoes - ANA' where the field [codigo] matches the selected [codigo] value on the selected item on the table above).

 

I tried this (and variations), unsuccessufully:

 

PreviousNegotiations = 

CALCULATETABLE(

'Extrato de negociacoes - ANA',

'Extrato de neogicaoces - ANA[Data Negocio] >= MIN(DateTable[Date]) && 'Extrato de negociacoes - ANA[Data Negocio] <= MAX (DateTable[Date]),

'Extrato de negociacoes - ANA[Codigo] = SELECTEDVALUE('Extrato de negociacoes'[codigo], Blank())

)

 

I tried to store the paramaters on variables too, but they didn't match the selected values of the data slicer. I have no idea why.

 

I don't have a clue why anything I tried is working, and I don't know anywhere else to go!

I'd appreciate any help.

 

Images bellow: 

Slicer that filters DateTable valuesSlicer that filters DateTable valuesI need two table visuals: the top one is working fine. The bottom one should show all previous negotiations with the selected stock on the top table.I need two table visuals: the top one is working fine. The bottom one should show all previous negotiations with the selected stock on the top table.How the tables are relationed.How the tables are relationed.

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Like @AllisonKennedy  said, calculated tables will not update based on filters, slicers, or selection in your report.

The SELECTEDVALUE function does not work in CALCULATETABLE function. You can remove the filter conditions for Codigo.

You can create a relationship between your new table and the old table with Codigo, and then create a slicer to filter.

 

Best Regards,

Stephen Tao

 

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

AllisonKennedy
Super User
Super User

Calculated tables will not update based on filters, slicers, or selection in your report, so you need to build a Measure that will do this for you. This might mean that you need to create an unrelated table to help you out as well. I'm not sure if this is exactly the same, but I have done a webinar on this recently that might help: https://www.excelwithallison.com/MCT/news Click 'Watch Now' on the ACE Training: Opportunity Analysis webinar link. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.