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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Create a slicer or filter from a Measure

I am trying to create a slicer or filter for a measure

 

My source data only has a "Billing Start date" and no "Billing Finish Date" we only have the term of contract i.e. 12, 24, 36, etc

 

I have created a measure to create "Billing Finish Date"

 

Billing Finish Date = VAR vStartDate = MAX ( 'All Bookings'[Billing Start] ) VAR vTermMonths = MAX ( 'All Bookings'[Term] ) VAR vFinishDate = IF ( vTermMonths <> 1, EDATE ( vStartDate, vTermMonths - 1 ) ) VAR vResult = IF ( HASONEVALUE ( 'All Bookings'[Contract#] ), vFinishDate ) RETURN vResult
 
From this, I have created an "In Range" measure, which equals either "Expired" or "Booked"
 
In Range = IF('All Bookings'[Billing Finish Date]<=TODAY(),"Expired","Booked")
 
Now I need to Filter or add slicer against "Expired", "Booked"
 
Any help, advice would be appreciated 
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Based on your explanation, I create a sample file, you can take it for reference. See sample file attached below.

Besides, the easiest way is to create a column,

In Range Col = IF('All Bookings'[Billing Finish Date]<=TODAY(),"Expired","Booked")

Then, drag this column into the slicer:

v-xiaotang_0-1621421207601.png

Result:

v-xiaotang_1-1621421207606.png

Best Regards,

Community Support Team _ Tang

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

View solution in original post

6 REPLIES 6
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Based on your explanation, I create a sample file, you can take it for reference. See sample file attached below.

Besides, the easiest way is to create a column,

In Range Col = IF('All Bookings'[Billing Finish Date]<=TODAY(),"Expired","Booked")

Then, drag this column into the slicer:

v-xiaotang_0-1621421207601.png

Result:

v-xiaotang_1-1621421207606.png

Best Regards,

Community Support Team _ Tang

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

Anonymous
Not applicable

Works like a dream thank you 🙂

amitchandak
Super User
Super User

@Anonymous , You have to create an independent table(NewTable) with these two values

 

Create measures using this

countx(filter(values(Bookings[Contract#]), [In Range] =max(NewTable[Value])),Bookings[Contract#])

 

Check my video on a similar topic

Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

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
Anonymous
Not applicable

As I can't get this to work do I have any other options in being able to filter my data?

Anonymous
Not applicable

When I try to create the new measure suggested with the new table name I get lots of errors

 

Capture.JPG

 

Any help will be appreciated

Anonymous
Not applicable

Thank you for such a quick answer

 

I have watched the video but as yet can’t get my head around what needs to be done, I believe I only need a small portion of your video and need two columns

 

Contract # and In Range

 

Is that correct?

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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