Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi guys,
I'm new here and I have the following scenario:
I use the SalesForce opportunities base and I have a calendar table. The two are related by the opportunity's closing date. (Making it clear that in the Opportunity table, the data is not repeated)
My structure is as follows in the Opportunity table:
I need to make a table with the months of the year and how many active opportunities per month.
For example: Opportunity 1 opened in January and closed in July. It has to appear active in January, February, March, April, May, June and July.
How can I do this? I can't solve it 😞
Thank you in advance!
Solved! Go to Solution.
@Anonymous,
This solution uses a disconnected date table SlicerDate. It does not have any relationships with other tables.
Measure:
Active Opportunities =
VAR vMinDate =
MIN ( SlicerDate[Date] )
VAR vMaxDate =
MAX ( SlicerDate[Date] )
VAR vResult =
CALCULATE (
COUNT ( Opportunity[ID] ),
// creation date in current month
( Opportunity[Creation date] >= vMinDate
&& Opportunity[Creation date] <= vMaxDate )
// closing date in current month
|| ( Opportunity[Closing date] >= vMinDate
&& Opportunity[Closing date] <= vMaxDate )
// creation date in earlier month and closing date in later month
|| ( Opportunity[Creation date] < vMinDate
&& Opportunity[Closing date] > vMaxDate )
)
RETURN
vResult
Create visual with SlicerDate[Month]:
Proud to be a Super User!
@Anonymous,
This solution uses a disconnected date table SlicerDate. It does not have any relationships with other tables.
Measure:
Active Opportunities =
VAR vMinDate =
MIN ( SlicerDate[Date] )
VAR vMaxDate =
MAX ( SlicerDate[Date] )
VAR vResult =
CALCULATE (
COUNT ( Opportunity[ID] ),
// creation date in current month
( Opportunity[Creation date] >= vMinDate
&& Opportunity[Creation date] <= vMaxDate )
// closing date in current month
|| ( Opportunity[Closing date] >= vMinDate
&& Opportunity[Closing date] <= vMaxDate )
// creation date in earlier month and closing date in later month
|| ( Opportunity[Creation date] < vMinDate
&& Opportunity[Closing date] > vMaxDate )
)
RETURN
vResult
Create visual with SlicerDate[Month]:
Proud to be a Super User!
@DataInsights , hey! 🙂
Thank you for your help! This works perfectly.
In my structure there is already a calendar table related to several other tables. I'll create one just for this kind of situation... I hope it won't be a problem.
I really appreciate it 🙂 Have a nice week.
Hi Amanda,
Glad to hear that works. That's the correct approach--keep the main calendar table in your data model (with relationships to other tables).
Have a good week. 🙂
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |