cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Rygaard
Resolver I
Resolver I

is this month (or any other value) selected ?

I have a month slicer

Now i want to return the value 1 if a month is selected and 0 if it is not selected.

 

ultimatly i want to use this as an easy way to format stuff

 

but for now i just want it to show in another table where i have all the month 1-12 and i want the value Either 0 or 1..

 

I can not use isfiltered, because.. well the matrix in its own will apply the filter......   

 

My slicer is not filtering my matrix (obvioisly) 

 

So on this matrix 3 and 7 should have "1" and the rest 0

 

 

2023-02-14 14_41_16-#Master - Power BI Desktop.png

1 ACCEPTED SOLUTION

Hi @Rygaard ,

 

Yes, two tables are necessary depending on your needs. You can hide and more according to your needs.
(1) We can create two tables. Be careful not to build relationships.

Calendar = CALENDAR(DATE(2023,1,1),DATE(2023,12,31))
Month = DISTINCT('Calendar'[Date].[MonthNo])

vtangjiemsft_0-1676510629382.png

(2) Create a measure.

Is selected Yes/NO = 
var _selectedvalues=VALUES('Month'[MonthNo]) 
return IF(MONTH(MAX('Calendar'[Date])) in _selectedvalues,1,0)

(3) Then the result is as follows.

vtangjiemsft_1-1676510678631.png

Please refer my pbix file.

 

Best Regards,

Neeko Tang

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
v-tangjie-msft
Community Support
Community Support

Hi @Rygaard ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.

Slicer Table:

vtangjiemsft_0-1676453032643.png

 

Table:

vtangjiemsft_1-1676453032645.png

 

(2) We can create a measure.

 

yes or no =

var a=VALUES('Slicer Table'[Month])

return IF(ISFILTERED('Slicer Table'[Month])=FALSE(),0,IF(MAX('Table'[Month]) in a,1,0))

 

(3) Then the result is as follows.

vtangjiemsft_2-1676453032646.png

Please refer my pbix file.

 

Best Regards,

Neeko Tang

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

It is only working if you have 2 sepperate tables i was hoping to acomplise this within my Calender table

 

So Month in the slicer and month in the matrix is both from my calender table.  but the slicer is not filtering the matrix (only some other stuff on the page)

 

but if this is the only way i will make a "hidden" Calender table that runs in paralell.

Hi @Rygaard ,

 

Yes, two tables are necessary depending on your needs. You can hide and more according to your needs.
(1) We can create two tables. Be careful not to build relationships.

Calendar = CALENDAR(DATE(2023,1,1),DATE(2023,12,31))
Month = DISTINCT('Calendar'[Date].[MonthNo])

vtangjiemsft_0-1676510629382.png

(2) Create a measure.

Is selected Yes/NO = 
var _selectedvalues=VALUES('Month'[MonthNo]) 
return IF(MONTH(MAX('Calendar'[Date])) in _selectedvalues,1,0)

(3) Then the result is as follows.

vtangjiemsft_1-1676510678631.png

Please refer my pbix file.

 

Best Regards,

Neeko Tang

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

I will Accept this as a solution next week (have it in calender).. but hoping for some magic bullet input 😉  - since i would rather avoid the hidden Calender, not connected table version... if at all possible 🙂

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors