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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bsz412
Helper III
Helper III

how to print selected value as a fix number as calculated column

Hi,

 

I have a slicer where user can select one month from a dropdown list as start month.

 

 

bsz412_0-1647635853889.png

I would need to add the selected month number as a fixed value as a calculated column. 

this is my Start_month table, and in the "Selected" calculated column I would like to see 3 for each row

 

bsz412_1-1647635946118.png

how could I create that column?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @bsz412 ,

 

I just created a table with Date column to test.

Eyelyn9_0-1647939215082.png

And we need to create three tables for three slicers with all Year/ all Months:

Eyelyn9_1-1647939474163.png

Then please create a flag measure, and apply it to visual-filter pane, set as "is 1"

Filter Flag = 
var _minDate=DATE(MIN('Year slicer'[Year]),MAX('Start Month'[Value]),1)
var _maxDate=DATE(MAX('Year slicer'[Year]),MAX('End Month'[Value])+1,1)
RETURN IF(MAX('Table'[Date]) >=_minDate && MAX('Table'[Date])<_maxDate,1,0)

 The original table will be filtered between 2020/7/1- 2021/2/28:

Eyelyn9_2-1647939597256.png

Best Regards,
Eyelyn Qin
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

4 REPLIES 4
Anonymous
Not applicable

Hi @bsz412 ,

 

I just created a table with Date column to test.

Eyelyn9_0-1647939215082.png

And we need to create three tables for three slicers with all Year/ all Months:

Eyelyn9_1-1647939474163.png

Then please create a flag measure, and apply it to visual-filter pane, set as "is 1"

Filter Flag = 
var _minDate=DATE(MIN('Year slicer'[Year]),MAX('Start Month'[Value]),1)
var _maxDate=DATE(MAX('Year slicer'[Year]),MAX('End Month'[Value])+1,1)
RETURN IF(MAX('Table'[Date]) >=_minDate && MAX('Table'[Date])<_maxDate,1,0)

 The original table will be filtered between 2020/7/1- 2021/2/28:

Eyelyn9_2-1647939597256.png

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

@Anonymous OMG, this is great, thank you so much!

tackytechtom
Super User
Super User

Hi @bsz412 ,

 

My initial thought was that this shouldn't be possible because the values in the calculated column are updated during a data refresh. This means any time your selection in the report would change, the value in the calculated column will not update. 

Here they discussed this issue:

Solved: Using Slicer values in a calculated column - Microsoft Power BI Community

 

And here another suggestion for a solution:

Power BI calculated column based on Slicer - deBUG.to

 

Does this help? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hi @tackytechtom,

Thanks for the clarification. The reason why I was trying this, is because I have to build a period slicer that looks like this

 

bsz412_0-1647642436350.png

They insist so hard, so building something else instead is unfortunately not an option. I was hoping that capturing the start year&month combo and end year&month in a measure can somehow help me filter the calendar table to the values that fall in between those 2 values. 

Right now I have no idea how will I create this format 😞

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors