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

Show only if equal to last date

Hi there, 

 

I have the following data that I am filtering buy a Value_date. I only want to show the deal id if it's last value date is equal to the last date specified in the filter. 

 

AA Last value date is a measure with 

AA Last value date = max(InterestAccrual[ValueDate_Date])
 
So it should not show the ones highlighted:
c2.JPG
 
Is there a way to do this?
 
Thanks,
Annemie
 
 
 
 
 
12 REPLIES 12
Anonymous
Not applicable

@Annemie19  you can use this function 
A Last value date = LASTDATE(InterestAccrual[ValueDate_Date])

Thank you 

@Annemie19 

The link provided explains it quite well, I think, but if that is not enough I would need a sample pbix (mock or real data) and I can build it for you. That'd probably be easier to follow than trying to explain here.

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

@AlB 

It is not allowing me to attach pbix files but here is table data.

Thanks a lot. 

 

ShortNameDealTypeDealIDDealNumberNomineeNameAA Nominal AmountAA Last Proj_dateAA Last value dateAA total Interest AccrualAA Days diff
AEXXXXXXXShare IssueSI000165-01675 NeXXXXXXX5000000003/11/200103/11/2001-11788.51
AEXXXXXXXShare IssueSI000176-01688 deXXXXXXX5000000018/01/200218/01/2002-12753.421
AEXXXXXXXShare IssueSI000177-01689 deXXXXXXX5000000022/01/200222/01/2002-13089.041
AEXXXXXXXShare IssueSI000179-01692XXXXXXXLoXXXXXXX2000000015/01/200215/01/2002-4701.371
AEXXXXXXXShare IssueSI000179-021696IGXXXXXXXLoXXXXXXX2000000015/07/200215/07/2002-5084.931
AEXXXXXXXShare IssueSI000179-031849IGXXXXXXXLoXXXXXXX2000000029/11/200229/11/2002-5402.741
AEXXXXXXXShare IssueSI000180-01693 CoXXXXXXX10000000014/01/200214/01/2002-24219.181
AEXXXXXXXShare IssueSI000190-01704IGXXXXXXXE.XXXXXXX500000005/03/200205/03/2002-1284.931
AEXXXXXXXShare IssueSI000199-01713IGXXXXXXXJoXXXXXXX100000019/03/200219/03/2002-287.671
AEXXXXXXXShare IssueSI000613-021537XXXXXXXBaXXXXXXX2500000012/09/200112/09/2001-5363.011
AEXXXXXXXShare IssueSI000613-031678XXXXXXXBaXXXXXXX2500000012/03/200212/03/2002-5410.961
AEXXXXXXXShare IssueSI000680-011691XXXXXXXFiXXXXXXX5000000020/11/200220/11/2002-13795.811
AEXXXXXXXShare IssueSI000680-021946ILXXXXXXXFiXXXXXXX5000000028/11/200328/11/2003-10520.551
AEXXXXXXXShare IssueSI000690-011718IGXXXXXXXSaXXXXXXX1700000029/03/200529/03/2005-4704.111
AEXXXXXXXShare IssueSI000690-022596XXXXXXXSaXXXXXXX1700000001/04/200801/04/2008-4187.121
AEXXXXXXXShare IssueSI000700-011751IGXXXXXXXSaXXXXXXX2000000010/05/200510/05/2005-5547.951
AEXXXXXXXShare IssueSI000700-022640 SaXXXXXXX2000000012/05/200812/05/2008-5095.891
AEXXXXXXXShare IssueSI001263-035808 SaXXXXXXX55000000030/09/202030/09/2020-62232.881
AEXXXXXXXShare IssueSI001282-025768 SaXXXXXXX8000000030/09/202030/09/2020-9052.051
AEXXXXXXXShare IssueSI001514-015354ClXXXXXXXSaXXXXXXX15000000030/09/202030/09/2020-16972.61
AEXXXXXXXShare IssueSI001523-015728SPXXXXXXXInXXXXXXX3500000030/09/202030/09/2020-3356.161
AEXXXXXXXShare IssueSI001527-015895SPXXXXXXXInXXXXXXX9000000020/08/202030/09/2020-371993.4342
AEXXXXXXXShare IssueSI001529-015949SPXXXXXXXInXXXXXXX2500000020/08/202030/09/2020-103331.542
AEXXXXXXXShare IssueSI001530-016130SPXXXXXXXInXXXXXXX10000000020/07/202030/09/2020-864929.2973
AEXXXXXXXShare PurchaseSP000065-01686 InXXXXXXX-20000000018/12/200021/06/200388939051.28916
AEXXXXXXXShare PurchaseSP000836-015274 IEXXXXXXX-420000000*30/04/202030/09/20205839799.04154
AEXXXXXXXShare PurchaseSP000871-015628SIXXXXXXXInXXXXXXX-15900000001/07/202030/09/20201947327.4392
AEXXXXXXXShare PurchaseSP000872-015630SIXXXXXXXInXXXXXXX-16000000001/07/202030/09/20201959574.7592
AEXXXXXXXShare PurchaseSP000897-016029ClXXXXXXXInXXXXXXX-83000000030/09/202030/09/202082249.591
AEXXXXXXXShare PurchaseSP000898-016030ClXXXXXXXInXXXXXXX-15000000020/08/202030/09/2020640183.5642
AEXXXXXXXShare PurchaseSP000905-016149A XXXXXXXBuXXXXXXX-11886102020/07/202030/09/20201674673.3273
AEXXXXXXXShare PurchaseSP000906-016150C XXXXXXXBuXXXXXXX-2462330.7620/07/202030/09/202034692.6273
AEXXXXXXXShare PurchaseSP000907-016151A XXXXXXXBuXXXXXXX-2139858020/07/202030/09/2020301491.8873
AEXXXXXXXShare PurchaseSP000908-016152C XXXXXXXBuXXXXXXX-835908.3620/07/202030/09/202011777.473
AEXXXXXXXShare PurchaseSP000909-016153A XXXXXXXBuXXXXXXX-2547450020/07/202030/09/2020358918.973
AEXXXXXXXShare PurchaseSP000910-016154C XXXXXXXBuXXXXXXX-95196620/07/202030/09/202013412.5773
AEXXXXXXXShare PurchaseSP000911-016155A XXXXXXXBuXXXXXXX-1308190520/07/202030/09/2020184315.4173
AEXXXXXXXShare PurchaseSP000912-016156C XXXXXXXBuXXXXXXX-812300.3120/07/202030/09/202011444.7873
AEXXXXXXXShare PurchaseSP000913-016169A XXXXXXXK2XXXXXXX-262237520/07/202030/09/202036947.5373
AEXXXXXXXShare PurchaseSP000914-016170C XXXXXXXK2XXXXXXX-104079.520/07/202030/09/20201466.4173

@Annemie19 

You can share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

@AlB 

 

Here is the link:

 

021 forum.pbix

 

Kind Regards, 

Annemie

@Annemie19 

1. Create this measure:

 

Show Measure = 
VAR isLast_ = 
   SELECTEDVALUE(data021_forum__2[AA Last value date]) =
   CALCULATE(MAX(data021_forum__2[AA Last value date]),ALLEXCEPT(data021_forum__2,data021_forum__2[ShortName], data021_forum__2[DealType])) 
RETURN
IF(isLast_, 1, 0)

 

It assumes you want to look at date by ShirtName and DealType. If you want  the latest date per only  ShirtName it needs only ShortName in the ALLEXCEPT(): 

 

Show Measure = 
VAR isLast_ = 
   SELECTEDVALUE(data021_forum__2[AA Last value date]) =
   CALCULATE(MAX(data021_forum__2[AA Last value date]),ALLEXCEPT(data021_forum__2,data021_forum__2[ShortName])) 
RETURN
IF(isLast_, 1, 0)

 

2. Select the visual and place the measure in the visual filters. Select to show when value of the measure is 1

AlB_0-1603621013606.png

3. See it all at play in the attached file

4. I would recommend to have a proper date table and use it for filtering instead of using the date  columns in your main/fact table. I would also recommend not to use the data hierarchy feature and use the date table instead  (https://community.powerbi.com/t5/Desktop/How-to-remove-Date-Hierarchy/td-p/647711)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

 

 

 
 
 

 

@AlB 

 

thanks a lot. But, it is now giving me and error that 'SELECTEDVALUE' is not a function:

 

Annemie19_0-1603686328999.png

 

Do you know how I can resolve this?

 

Kind Regards, 

Annemie

Anonymous
Not applicable

@Annemie19  you can use this  SELECTEDVALUE( ) put date value inside this ,may be some spell mistake will be there.

 

@Annemie19 

Perhaps there's some restriction with SELECTEDVALUE() in the environment you are using? Try this:

aa Show Measure =
VAR isLast_ =
    IF (
        HASONEVALUE ( InterestAccrual[ValueDate_Date] ),
        VALUES ( InterestAccrual[ValueDate_Date] )
    )
        = CALCULATE (
            MAX ( InterestAccrual[ValueDate_Date] ),
            ALLEXCEPT ( Subsidiary, Subsidiary[ShortName] )
        )
RETURN
    IF ( isLast_, 1, 0 )

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

Hi @aib

 

It is just showing zeros for all items. 

Annemie19_1-1603783887413.png

 

 

this is the measure I used:

 

aa Show Measure =
VAR isLast_
= IF ( HASONEVALUE( InterestAccrual[ValueDate_Date]), VALUES(InterestAccrual[ValueDate_Date]))
= CALCULATE(max(InterestAccrual[ValueDate_Date]),ALLEXCEPT(Subsidiary,Subsidiary[ShortName]))
RETURN IF(isLast_, 1, 0)
 
Kind Regards, 
Annemie
AlB
Super User
Super User

Hi @Annemie19 

You can create a measure that returns a 1 when the rows is to be shown and a zero when it isn't. then use that measure as filter for the visual, showing values whne the measure is 1.

Check this out for further info:  https://www.sqlbi.com/articles/applying-a-measure-filter-in-power-bi/

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

Hi Aid,

 

I'm not really sure how to do this as I am quite new to powerbi. 

 

I need to write a measure to show only rows that have a value date which is equal to the last value date specified in the date slider. 

 

Kind Regards, 

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