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

Table with first day of year and current day

Hi everyone,

 

I have a requirement from my client to compare in the same table data from  a date selected from slicer and the first day of the year. I can't get correct data.

 

Sample data:

date_loadID
01/01/2017ID1
01/01/2017ID2
01/01/2017ID3
01/01/2017ID4
01/06/2017ID1
01/06/2017ID2
01/06/2017ID3
01/09/2017ID1
01/09/2017ID2
31/12/2017ID1
01/01/2018ID1
01/01/2018ID7

and two measures:

Start Year = CALCULATE(COUNTROWS(Table1);FILTER(Table1;Year(SELECTEDVALUE(Table1[date_load])) = YEar(Table1[date_load])))

Current = COUNTROWS(Table1)

 

I need to show for 1/1/2017

Start Year = 4

Current =4

 

and for 31/12/2017

Start Year = 4

Current =1

 

but get 

Start Year = 1

Current =1

 

Thank you in advance

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Juan_Lu

 

Try this MEASURE

 

Start Year =
CALCULATE (
    COUNTROWS ( Table1 ),
    FILTER (
        ALL ( Table1 ),
        Table1[date_load] = DATE ( YEAR ( SELECTEDVALUE ( Table1[date_load] ) ), 1, 1 )
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@Juan_Lu

 

Try this MEASURE

 

Start Year =
CALCULATE (
    COUNTROWS ( Table1 ),
    FILTER (
        ALL ( Table1 ),
        Table1[date_load] = DATE ( YEAR ( SELECTEDVALUE ( Table1[date_load] ) ), 1, 1 )
    )
)

Regards
Zubair

Please try my custom visuals

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.