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

How to calculate target by data?

Hi Everyone,

 

How i can calculate the target corresponding to the date and group?

 

https://1drv.ms/u/s!As-s3TNexQ8TipkPATGyYTW6Fbr-qA?e=gLg3Ev  

 

Capturar.PNGCapturar3.PNGCapturar4.PNG

2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

Here is a measure expression that returns the Target for the Date and Group on that row of the table.

 

GroupDate Target =
VAR __thisdate =
    SELECTEDVALUE ( Sales[Date] )
VAR __thisGroup =
    SELECTEDVALUE ( Sales[Group] )
RETURN
    CALCULATE (
        MAX ( Target[Target Conversation] ),
        ALL ( Target ),
        Target[StartDate] <= __thisdate,
        Target[EndDate] >= __thisdate,
        Target[Group] = __thisGroup
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Perfect, thanks for this solution.

View solution in original post

5 REPLIES 5
Harpreet1405_12
Helper II
Helper II

Hello,

 

I need your help to set the targets for the upcoming months (Oct 2022- SEPT 2023) BASED on the historical data,  I have the historical data from 2019 to 2022, so we go like Oct 2020-Sept 2021, Oct 2021-Sept 2022, Oct 2022-Sept 2023(I want to set the targets for these months) for 80 different programs or categories.

 

Is There any formula or any Dax function available.

 

I will highly appreciate the response.

 

Thank you

mahoneypat
Employee
Employee

Here is a measure expression that returns the Target for the Date and Group on that row of the table.

 

GroupDate Target =
VAR __thisdate =
    SELECTEDVALUE ( Sales[Date] )
VAR __thisGroup =
    SELECTEDVALUE ( Sales[Group] )
RETURN
    CALCULATE (
        MAX ( Target[Target Conversation] ),
        ALL ( Target ),
        Target[StartDate] <= __thisdate,
        Target[EndDate] >= __thisdate,
        Target[Group] = __thisGroup
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Perfect, thanks for this solution.

AntrikshSharma
Community Champion
Community Champion

You will have to explain more, not sure what you are trying to do.

I need returne in columm "Target_Conversation" the target active for the period. Example, in table "Target" have the columm name "Group" and others columns with Start date and End date for the group.

 

Then the "Group1" has 6% of Target with start 2020/04/01 and finish in 2020/04/05, i need return the value Target active for date for comparison the value realized and value projectedCapturar.PNG.

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.

Top Solution Authors