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

Opportunity created in current month

Dear All,

 

I've the below sample data set as shown below. This fact table linked to Date dimension based on closeddate.

I need to calcuate the belwo metrics.

 

New opportunity created = sum of the quanity for that particular month and isclose should be false, need to consider created date. 

 

marketing generated - sum of total qty for each month where mareketing generated is true

 

closed - sum of qty where isclosed is true

 

Opp_IDCLOSEDATEISCLOSEDCREATEDDATEQUANTITYMARKETING_GENERATED
0062p00000z9ieLAAQ8/26/2019TRUE7/23/201986FALSE
0062p00000z9imAAAQ8/13/2019TRUE7/23/201940FALSE
0062p000010NS6bAAG11/22/2019FALSE7/31/201944TRUE
0062p000010NV8cAAG8/12/2019TRUE8/2/201932FALSE
0062p000010NZPYAA49/2/2019TRUE8/6/201916FALSE
0062p000010O9wGAAS10/9/2019TRUE8/21/2019NULLTRUE
0062p000010OLzoAAG10/5/2019TRUE8/26/201921FALSE
0062p000010OON8AAO11/29/2019FALSE8/27/201959TRUE
0062p000010OUvPAAW9/2/2019TRUE8/30/2019NULLFALSE
0062p000010OdesAAC9/13/2019TRUE9/4/201946FALSE
0062p000010OhAcAAK3/13/2020FALSE9/6/201943TRUE
0062p000010OhRsAAK12/20/2019FALSE9/6/201920TRUE
0062p000010OpN7AAK9/18/2019TRUE9/12/2019NULLTRUE
0062p000010fDUGAA29/16/2019TRUE9/13/20195FALSE
0062p000010fJJ7AAM12/27/2019FALSE9/17/201941TRUE
0062p000010fJFZAA25/15/2020FALSE9/17/201926FALSE
0062p000010fQctAAE2/14/2020FALSE9/20/2019NULLFALSE
0062p000010fTmUAAU9/26/2019TRUE9/23/20194TRUE
0062p000010fWKrAAM11/15/2019FALSE9/24/201918TRUE
0062p000010fYUWAA29/30/2019TRUE9/25/2019NULLTRUE
0062p000010fmNdAAI11/22/2019FALSE10/1/201912FALSE
0062p000010fmMQAAY11/22/2019FALSE10/1/201944FALSE
0062p000010fwldAAA10/9/2019TRUE10/4/20195FALSE
0062p000010fxA8AAI11/22/2019FALSE10/4/201914FALSE
0062p000010fzPfAAI10/25/2019TRUE10/5/201921TRUE
0062p000010fzPGAAY11/15/2019FALSE10/5/201954FALSE
0062p000010gHdxAAE10/17/2019TRUE10/11/201918FALSE
0062p000010gJnmAAE11/15/2019FALSE10/13/2019NULLFALSE
0062p000010gY5kAAE12/20/2019FALSE10/20/2019NULLFALSE
0062p000010gY5pAAE11/29/2019FALSE10/20/2019NULLFALSE
0062p000010gaM3AAI1/17/2020FALSE10/21/2019NULLFALSE

 

Output should look like below;

 

MonthJanFebMar
New opportunites created    
Marketing generated   
closed   
Total Qty   

 

Thanks for the support.

5 REPLIES 5
Washivale
Resolver V
Resolver V

Hi @Anonymous ,

 

You got a good use case to use "USERELATIONSHIP" function of dax in this case.

 

Create an inactive relationship between createddate and Date dimension.

 

then for this (New opportunity created = sum of the quanity for that particular month and isclose should be false, need to consider created date.) create a measure as below:

 

New Opportunity Created = Calculate(SUM(Quantity), isClose = false, USERELATIONSHIP(createddate, Date[Date]))

 

for marketing generated = calculate (SUM(Quantity), [marketing generated] = true) 

 

for closed if you are looking to get closed values based on closed date , you can create measure as below:

 

closed = Calculate(SUM(QUANTITY), isclosed = true) should do the trick

 

let me know if it helps

 

Regards,

Washivale

 

 

Anonymous
Not applicable

Hi, I tried to use the below expression but nothig is showing the table.

 

New Opportunities Created = CALCULATE(sum(Opportunities[TOTALOPPORTUNITYQUANTITY]),Opportunities[ISCLOSED]="false",USERELATIONSHIP(Opportunities[CREATEDDATE],'Calendar'[Date]))

Hi @Anonymous ,

 

let me know from which table you have selected date column in matrix to see the results, also let me know format for created date column and isclosed column

 

 

Regards,

washivale

 

PattemManohar
Community Champion
Community Champion

@Anonymous Please follow the below steps:

 

1. Create a new column as Type as below

 

Type = 
VAR _NewOpportunity = IF(Test10[ISCLOSED]=FALSE(),"Y","N")
VAR _Marketing = IF(Test10[MARKETING_GENERATED]=TRUE(),"Y","N")
VAR _Closed = IF(Test10[ISCLOSED]=TRUE(),"Y","N")

RETURN SWITCH("Y",_NewOpportunity,"New Opportunity Created"
                 ,_Marketing,"Marketing Generated"
                 ,_Closed,"Closed"
             )

2. Now use the Matrix visual, having the new column created above as Rows and Created Date as Columns and Quantity as Values.

 

image.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Hi, Thanks for the reply.

 

I've created date and closed date in fact table and currently i liked the close date to date dimension.

 

To calculate new opportunity created, i need to consider the Created date and to calculated closed, i need to conisder the close date.

 

I think in the given screenshot you only showing the created date. Please clarify.

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.