Forum Discussion
change the table order based on a dynamic slicer values
Hi,
I created a calculated table with two values, 'Yes' and 'No', to be used in a slicer. I have a table called 'ATL' with a column named 'orderDate' that contains product order dates. I would like to sort the 'ATL' table in ascending order by the 'orderDate' column when 'Yes' is selected from the previously created slicer.
Could anyone assist me with achieving this?
Thank You.
Here is my Approach to it :
Step 1 - I created two date tables One with dates sorted in Asc order, another one with Dates sorted in Desc Order.
Step 2 - create a relationship between Date Column of these date tables with the Date column in Fact table . In your Case ATL table ( order Date Column )
Step 3 - Create a Field parameter, add date Columns from both date tables ( that we created in step 1)
Step 4 - in the Dax of field Parameters, also add another column Values "Yes" and "NO", - these will be used to build a relationship with your calculated table that you are using as a slicer. Alternatively you can use this column as a slicer itselfIn the following code you can see how to add the Yes and No , to create a new column for field parameter table that gets created.
Step 5 Create a relationship between your slicer table and field parameter.
Here is how the data model will look likeStep 6 - Now When creating the Matrix Visual, instead of using dates from date tables or fact tables, Add Field parameter to the rows
Step 7 Create the Yes / No Slicer.
that should give you required results.I hope this helps.
and I am curious if someone else over here has a different approach to this scenario
2 Replies
- Jpss
Resolver II
Here is my Approach to it :
Step 1 - I created two date tables One with dates sorted in Asc order, another one with Dates sorted in Desc Order.
Step 2 - create a relationship between Date Column of these date tables with the Date column in Fact table . In your Case ATL table ( order Date Column )
Step 3 - Create a Field parameter, add date Columns from both date tables ( that we created in step 1)
Step 4 - in the Dax of field Parameters, also add another column Values "Yes" and "NO", - these will be used to build a relationship with your calculated table that you are using as a slicer. Alternatively you can use this column as a slicer itselfIn the following code you can see how to add the Yes and No , to create a new column for field parameter table that gets created.
Step 5 Create a relationship between your slicer table and field parameter.
Here is how the data model will look likeStep 6 - Now When creating the Matrix Visual, instead of using dates from date tables or fact tables, Add Field parameter to the rows
Step 7 Create the Yes / No Slicer.
that should give you required results.I hope this helps.
and I am curious if someone else over here has a different approach to this scenario - AnonymousNot applicable
Hi,
The reply Jpss offers should be helpful.
Best Regards,
Wisdom Wu