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

Date Slicer and Measure

Hi All, 


Can't seem to find a solution and have tried many ways. I have the following measure: 

 

Remaining Shares Unvested =
CALCULATE (
SUM( 'Equity'[Share Splits] ),
'EquityFull'[New Vest Date] >= DATE (2019, 4, 1)
)

 

What I want to do is to create a date range slicer based on the NEW VEST DATE field that will effect ONLY this measure here. I essenitally want it to sum the Share Splits column based on a date range. 

 

I can't seem to get it to work. 

 

Any help would be great please. Thanks!!

1 ACCEPTED SOLUTION

@Anonymous let's assume your date table is called "Calendar". Try following measure and tweak as per your need.

 

myMeasure = 
VAR startDate = MIN(Calendar[Date])
VAR endDate = MAX(Calendar[Date])
RETURN

CALCULATE (
SUM( 'Equity'[Share Splits] ),
FILTER( EquityFull,
'EquityFull'[New Vest Date] >= startDate &&
'EquityFull'[New Vest Date] <= endDate

)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
MarkLaf
Solution Sage
Solution Sage

Besides what I think you've already articulated, I'm guessing your issue is you also need to "cancel" the existing relationship between Equity and EquityFull, such that the new table your slicer is on is the only thing filtering the measure.

 

Full procedure:

 

  1. New Table in model (you need to pull over the foreign key for Equity and the Vest Date column - if unsure, just make a full copy of EquityFull with TableForSlicer = 'EquityFull'):
    TableForSlicer = 
    SELECTCOLUMNS(
       'EquityFull',
       "Equity Table's Foreign Key",[EquityID or whatever it's called],
       "Date",[New Vest Date]
    )
  2. Set up same relationship between Equity and TableForSlicer that you have between Equity and EquityFull, and make it inactive.
  3. Now build measure, ignoring relationship betwen Equity and EquityFull and explicitly calling relationship between Equity and this new table that will be driving the slicer:
    Remaining Shares Unvested =
    CALCULATE (
       SUM( 'Equity'[Share Splits] ),
       ALL('EquityFull'),  //i.e. ignore any other filters/slicers you may have on EquityFull
       USERELATIONSHIP(
         'Equity'[ID or whatever key is called],
         'TableForSlicer'[Equity Table's Foreign Key]
       )
    )
    You can add additional built-in filters on TableForSlicer if needed, like the >= DATE (2019, 4, 1) one used before.
  4. Now you can add a date slicer with 'TableForSlicer'[New Vest Date], and that measure will be sliced by it and nothing else.
parry2k
Super User
Super User

@Anonymous Create another date table and use that for slicer and then from that date table, use date range in your measure. let me know if you need further assistance on this.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi @parry2k,

 

I know I can create a date table from the new vest date field, but it's the logic I can't get to work to sum dynamically within that measure. 

@Anonymous let's assume your date table is called "Calendar". Try following measure and tweak as per your need.

 

myMeasure = 
VAR startDate = MIN(Calendar[Date])
VAR endDate = MAX(Calendar[Date])
RETURN

CALCULATE (
SUM( 'Equity'[Share Splits] ),
FILTER( EquityFull,
'EquityFull'[New Vest Date] >= startDate &&
'EquityFull'[New Vest Date] <= endDate

)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

That worked. Thanks. 🙂

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.