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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dreyz64
Helper III
Helper III

Getting a slicer filtered value into a custom column

Hello everyone,

 

I am trying to create filters based on a slicer.

 

I have a table of sales and I have created a separate table with conditions on the years.

2020-05-06_10-57-59.jpg

 

The way I would like my report to work is:

If 'Show reliable YTD data' is selected, then I want to filter everything which belongs to this year and who's month is 2 months before today. Example: today the report would show all volumes for 2020 from Jan to March.

If 'Show all YTD data' is selected, then I want to filter everything which is not in 2020.

If 'Show all YTD data and Previous year' is selected, then I want to show everything from 2020 and 2019.

 

I would like to create a custom column in my Main table which would put 1 on each line that fulfills the above selected condition. Like this I can sum up the volume based only on the periods I want to consider.

2020-05-06_11-01-18.jpg

 

2020-05-06_11-07-31.jpg

2020-05-06_11-09-01.jpg

 

 

Then the aim would be that I create a measure that sums volume for every line where Custom col = 1.

Like this I can capture the sales corresponding to the periods I want filtered.

 

If you have a better approach do not hesitate to show me and thanks for the help!

4 REPLIES 4
amitchandak
Super User
Super User

@dreyz64 , did not get it completely, but refer if this can help

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak Thank you for the answer.

I basically want to filter my data based on criterias from a slicer.

But tbh creating new measures for every data is very inefficient... In Tableau a simple filter works... 

 

@dreyz64 

 

Values in a calculated column are fixed. But you may use ADDCOLUMNS in a measure.

https://www.sqlbi.com/articles/naming-temporary-columns-in-dax/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft Thank you for your answer, this indeed would be a bit better than creating so many new columns.

In the end, I bypassed the issue by using additional tables to filter the dates. Like this this I use one single volume column.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.