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

Dynamic measure to display results for current year and previous 2 years

Hi, 

I have a measure which works fine but I want it to display the results dynamically for current year and last 2 years instead of me manually selecting the years 

Is it possible?

 

Heres my current measure:

 

1. DistinctAccount = DISTINCTCOUNT('AccountTable'[AccountId])

 

2. AccountMembers= CALCULATE(
[DistinctAccount],
FILTER(
ALLSELECTED('Calendar'[Date]),
('Calendar'[Date] <= MAX('Calendar'[Date]) 
))
,FILTER(ALLSELECTED(Identifier[Termination Year]),(Identifier[Termination Year]>SELECTEDVALUE('Calendar'[Year])))

Please let me know

 

Thanks

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

not quite sure about what you want to achive, but two things you could try.

 

In you calendar table, add a column which is 1 if the date is within the date range you define, 0 if it is outside of this range. Than add this column to the filter of your visual, and set it to filter on 1.

 

or

 

Create a measure like this

 

accounts =
VAR t =
CALCULATE ( YEAR ( MAX ( table1[dato] ) ); ALL ( table1 ) ) - 2
RETURN
IF ( YEAR ( MIN ( Table1[dato] ) ) >= t; distinctcount( Table1[accountID] ); BLANK () )
 
regards,
Sturla

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

Not sure of what you want but try this - Flex a Pivot Table to show data for x months ended a certain user defined month.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

not quite sure about what you want to achive, but two things you could try.

 

In you calendar table, add a column which is 1 if the date is within the date range you define, 0 if it is outside of this range. Than add this column to the filter of your visual, and set it to filter on 1.

 

or

 

Create a measure like this

 

accounts =
VAR t =
CALCULATE ( YEAR ( MAX ( table1[dato] ) ); ALL ( table1 ) ) - 2
RETURN
IF ( YEAR ( MIN ( Table1[dato] ) ) >= t; distinctcount( Table1[accountID] ); BLANK () )
 
regards,
Sturla

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.