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
gwyn
New Member

Using only the top of a between date slicer.

Hi,

I'm looking to create a LASTNONBLANK measure for a column in a table visual. It works fine, but if the user moves the 'date between' slicer min(date) to beyond when the lastnonblank was logged it goes blank. 

I need the max(date) in the date slice to still effect to LASTNONBLANK measure. Is there some way to have the date table that the LASTNONBLANK measure scans over ignore the min(date) slicer values for the page?

 
DIGI STATUS =
VAR _START_TIMEALL ( 'T_DATE'[DATE] )  -- This to ignore all slicers on the date
VAR _END_TIMEMAX ( 'T_DATE'[DATE] ) -- This to still allow the max(date) slicer

RETURN
LASTNONBLANKVALUE(
DATESBETWEEN('T_DATE'[DATE]_START_TIME_END_TIME),   -- This is the bit where I fall down
MAX('HUBSPOT_HISTORIC_STATUS'[DIGITAL_ADVERTISING_STATUS])
)
 
There is a relationship between the dates table 'T_DATE' and the 'HISTORIC_STATUS' table.
 
4 REPLIES 4
AllisonKennedy
Super User
Super User

@gwyn I'm not quite sure what you're trying to acheive, but the ALL() function returns an entire table and you need a single scalar value. Dax.Guide is a great resource for what each function does. 

 

Try using MINX for your start time: 

 

DIGI STATUS =
VAR _START_TIME = MINX(ALL ( 'T_DATE'[DATE] ) ,'T_DATE'[DATE] )  -- This to ignore all slicers on the date
VAR _END_TIME = MAX ( 'T_DATE'[DATE] ) -- This to still allow the max(date) slicer

RETURN
LASTNONBLANKVALUE(
DATESBETWEEN('T_DATE'[DATE]_START_TIME_END_TIME),   -- This is the bit where I fall down
MAX('HUBSPOT_HISTORIC_STATUS'[DIGITAL_ADVERTISING_STATUS])
)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thank you, If i could send you a beer virtually I would.

@gwyn  Best reply ever - much thanks. Did you solve your problem then or still have more questions?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

All Sorted, I was clearly just trying to jam the whole (ALL(T_DATE) table into the DATESBETWEEN function where it wanted the MINX date value. I have successfully worked around the lower part of the slicer.  🍻

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.