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
JeanPierre
Frequent Visitor

Create a YTD Target

Hi everyone, 

 

I have a table that defines targets of a company and this table has 3 columns: CompanyID, DepartementID, Target.

So I created a measure 'Target (monthly)' that is the anual target divided by 12 and 'Target (anual)' that corresponds to the table's 'Target' column.

 

Now I need to create a measure that is equal to the accumulated target by month, however the table of targets has no date so I cannot do TOTALYTD. I tried to do something like this " Target (YTD) = Target (monthly)* Month('Calendar' [Date])", to multiply the monthly target by the number of the filtered month.  

 

My problem is that DAX forms do not allow me to write this measure.

 

Can someone help me??

 

Thanks.

1 ACCEPTED SOLUTION
fhill
Resident Rockstar
Resident Rockstar

The two tables below to the left are my raw data matching (I belive) your sample.  One table of CompanID, DepartmentID, & Annual Target).  My 2nd Table is a Linked By DepartmentID tables with Monthly Dates and Monthly Sales.

 

Once I created the join between DepartmentID I created the following Measures off the Detail Table:

SalesYTD = SUM(Table4[Sales])

Months = COUNTROWS(Table4)     *** You will probably need to do a conditional count here depending on department & Months, or hard code the value if you want to knock something out quick? ***

YTD_Target% = SUM(Table4[Sales]) / (SUM(Table3[Target])) 

Monthly Target = Table3[Target] / 12   ** Created on the Target Table **

+/- Goal = ( SUM(Table4[Sales]) / (SUM(Table3[Target]) / 12) ) - 1

 

 

To the right I have YTD Target % based on the SUM of Sales vs. Target by Department ID, and then a Monthly Detail by Date with Sales, Montly Target (Target / 12) and +/- Goal.  Lastly I quickly did a line graph showing how much each Month was UP or Down and did conditional formatting based on the values.

 

Hope this helps... 

FOrrest

 

Capture.PNG




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

3 REPLIES 3
fhill
Resident Rockstar
Resident Rockstar

The two tables below to the left are my raw data matching (I belive) your sample.  One table of CompanID, DepartmentID, & Annual Target).  My 2nd Table is a Linked By DepartmentID tables with Monthly Dates and Monthly Sales.

 

Once I created the join between DepartmentID I created the following Measures off the Detail Table:

SalesYTD = SUM(Table4[Sales])

Months = COUNTROWS(Table4)     *** You will probably need to do a conditional count here depending on department & Months, or hard code the value if you want to knock something out quick? ***

YTD_Target% = SUM(Table4[Sales]) / (SUM(Table3[Target])) 

Monthly Target = Table3[Target] / 12   ** Created on the Target Table **

+/- Goal = ( SUM(Table4[Sales]) / (SUM(Table3[Target]) / 12) ) - 1

 

 

To the right I have YTD Target % based on the SUM of Sales vs. Target by Department ID, and then a Monthly Detail by Date with Sales, Montly Target (Target / 12) and +/- Goal.  Lastly I quickly did a line graph showing how much each Month was UP or Down and did conditional formatting based on the values.

 

Hope this helps... 

FOrrest

 

Capture.PNG




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




SOLVED!!

 

Thank you @fhill, this really resolved my problem.

 

It was very useful 😉

 

Thanks.

MFelix
Super User
Super User

Hi @JeanPierre,

 

Instead of making the Measure that has the Month target, why don't you change your querie in order to add one row per month with that split?

 

that way yoyu would have the information and could link to your calendar table.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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.