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
saanah2019
Helper II
Helper II

Days between on slicer


I have one table with id, first day, last day, visit type and I want to make a calculated column (last day - first day) which shows the minimum for each visit regardless of the visit types chosen

 

So I have this so far: 

 

visit idfirst datelast datevisit typedays between(calculated column)
1001/1/20181/8/2018Session7
1001/2/20181/10/2018Orientation8
1011/3/20181/15/2018Session12
1011/4/20181/11/2018Peer7
1021/5/20181/23/2018Peer18
1031/6/20181/23/2018Group17
1031/7/20182/14/2018Individual38
1031/8/20181/16/2018Peer

8

 

 

 

 

But I want to only show 

 

visit idfirst datelast datevisit typedays between
1001/1/20181/8/2018Session7
     
     
1011/4/20181/11/2018Peer7
1021/5/20181/23/2018Peer18
     
     
1031/8/20181/16/2018Peer8

 

So basically, the end user can select any visit type and the file will find the least days between date and visit type and show that only.

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @saanah2019 ,

You can consider to create a measure to compare with current row content if it is last records and return tag. You can use this on visual level filter to filter unmatched records.

First Records =
VAR currlast =
    MAX ( T2[last date] )
VAR _last =
    CALCULATE ( MIN ( T2[last date] ), ALLSELECTED ( t2 ), VALUES ( T2[visit id] ) )
RETURN
    IF ( currlast = _last, "Y", "N" )

6.png

Regards,

XIaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @saanah2019 ,

You can consider to create a measure to compare with current row content if it is last records and return tag. You can use this on visual level filter to filter unmatched records.

First Records =
VAR currlast =
    MAX ( T2[last date] )
VAR _last =
    CALCULATE ( MIN ( T2[last date] ), ALLSELECTED ( t2 ), VALUES ( T2[visit id] ) )
RETURN
    IF ( currlast = _last, "Y", "N" )

6.png

Regards,

XIaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.