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
AliceW
Impactful Individual
Impactful Individual

See the values as they were at a given date - Opportunity Field History

Hi everyone,

I was wondering if anyone can help me with this issue.

What I have:

A table with Salesforce Opportunities and their main changed fields. Each row includes (among other cool things) this data: the Opportunity ID, the name of the field, when the change took place, what was the value being replaced, and what it was replaced with.

Opportunity IDChanged FieldChange DateToFrom
111Stage1-Oct-1912
111Stage9-Oct-1923
111Stage20-Oct-1937
222Stage2-Oct-1913

 

What I'm looking for:

To enable the user to see what Opportunities were in, say, Stage 2, at a given date he selects on the spot (in a filter).

For example, if October 3rd is selected, the selection would comprise of only Opportunity #111. 

If the user selects October 2nd, the will see two Opportunities (#111 and #222).

 

Some thoughts:

Perhaps a first step would be to build a new column with the previous change date? I don't know how to do that though.

Then create a separate date table for the filter the user to employ? I'm lost.

 

Help, please!

Thank you,

Alice

1 ACCEPTED SOLUTION

Hi @AliceW ,

 

I am very glad this is what you were looking for!

Here is the updated formula by removing Stage and Field name. I also improved it to take into account the rows with an empty next change date

 

Opportunities available = 

VAR selectedDate = LASTDATE('Date'[Date])
VAR selectedField = SELECTEDVALUE('Salesforce Opportunities'[Changed Field])
VAR selectedOpportunity = SELECTEDVALUE('Salesforce Opportunities'[Opportunity ID])
VAR selectedStage = [Stage Value]

VAR opportunityIsPresent =  COUNTX('Salesforce Opportunities',
IF([Opportunity ID]=selectedOpportunity && [Change Date]<=selectedDate && OR([Next Change Date]>selectedDate,[Next Change Date]=BLANK() ), 1, BLANK())
)

RETURN IF(opportunityIsPresent>0, "Opportunity", BLANK())

What do you mean that when you select January it shows both opportunities? I select January and I see 0 opportunities.

Here is my screenshot

 

Image 2019-10-21 at 7.17.12 PM.png

Do not hesitate to let me know if you have any more question,

 

LC

View solution in original post

11 REPLIES 11

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.