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
Pallavi_m
Helper I
Helper I

How to create a measure based on slicer selection

Hi,

 

I have a table that contains these values.. upto Oct 2040(monthyear)

A slicer is created on monthyear column.

-As per the slicer selection, I want to have a  measure that displays Oct 2022 if Oct2022 is selected in the slicer.

-As per the slicer selection, I want to have a  measure that displays Nothing if Dec2022 is selected in the slicer, as data wont be available currently for future years.

- As per the slicer selection, I want to have a  measure that displays Jan 2022 if Jan2022 is selected in the slicer, as data woould be present for the past.

 

 

 

idindexyearmonthmonthyear
20221120221

Dec 2021

20222220222Jan 2022
20223320223Feb 2022
20224420224Mar 2022
20225520225Apr 2022
20226620226May 2022
20227720227Jun 2022
20228820228Jul 2022
20229920229Aug 2022
20221010202210Sep 2022
20221111202211Oct 2022
20221212202212Nov 2022
202311320231Dec 2022
202321420232Jan 2023
2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @Pallavi_m ,

 

If you create a relationship between your Period and Fact tables, the measure will naturally show blank if the month  selected in  period doesn't exist yet in your fact table. You can create a Month Year calculated colum in Fact, say

Month Year = FORMAT ( Fact[Date], "MMM YYYY" ) and then create relationship between this column and monthyear in Period.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-jayw-msft
Community Support
Community Support

Hi @Pallavi_m ,

 

Create a measure like below and add it to visual filter set value = 1.

Measure = IF(SELECTEDVALUE('Table'[monthyear]) in VALUES('calendar'[monthyear])&&DATEVALUE(SELECTEDVALUE('Table'[monthyear]))<=EOMONTH(TODAY(),0),1,0)

 

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

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Pallavi_m ,

 

Create a measure like below and add it to visual filter set value = 1.

Measure = IF(SELECTEDVALUE('Table'[monthyear]) in VALUES('calendar'[monthyear])&&DATEVALUE(SELECTEDVALUE('Table'[monthyear]))<=EOMONTH(TODAY(),0),1,0)

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
danextian
Super User
Super User

Hi @Pallavi_m ,

 

If you create a relationship between your Period and Fact tables, the measure will naturally show blank if the month  selected in  period doesn't exist yet in your fact table. You can create a Month Year calculated colum in Fact, say

Month Year = FORMAT ( Fact[Date], "MMM YYYY" ) and then create relationship between this column and monthyear in Period.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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.

Top Solution Authors