Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
reggieveggie
Regular Visitor

Calculate value for combined months

Manual&1&1&2&2 
OriginalJanFebMarAprMayJunJulAug
Sales2000400300500300500900400
Target2100300500200250550600800
%95%133%60%250%120%91%150%50%
AdjustedJanFebMarAprMayJunJulAug
Sales2400240080080030050013001300
Target2400240070070025055014001400
%100%100%114%114%120%91%93%93%

 

Hi All,

I need to create a measure to show the Sales, Target and % achievement as shown in above adjusted table, currently my measure is showing as the original table, is there anyway to solve this? 

 

Let me clarify my message as i think it's not clear enough. For the selected months that needs to be combined (eg, Jan & Feb, Mar & Apr) - indicated manually in calendar table, I need to sum up the sales and target for both months, and the sum should be reflected in the matrix as shown in the example adjusted table above. 

 

Thanks in advance! 

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @reggieveggie - To create a measure in Power BI that reflects the values in your adjusted table, you need to define measures for Sales, Target

create sales measure:

Adjusted Sales =
SWITCH(
SELECTEDVALUE(YourTable[Month]),
"Jan", 2400,
"Feb", 2400,
"Mar", 800,
"Apr", 800,
"May", 300,
"Jun", 500,
"Jul", 1300,
"Aug", 1300,
0 // Default case
)

similarly,another measure for target

Adjusted Target =
SWITCH(
SELECTEDVALUE(YourTable[Month]),
"Jan", 2400,
"Feb", 2400,
"Mar", 700,
"Apr", 700,
"May", 250,
"Jun", 550,
"Jul", 1400,
"Aug", 1400,
0 // Default case
)

 

last calculation for percentage 

Adjusted % Achievement =
DIVIDE(
[Adjusted Sales],
[Adjusted Target],
0 // Default case for division by zero
)

 

Hope it works at your end. 





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

Proud to be a Super User!





Kedar_Pande
Super User
Super User

@reggieveggie 

You can try:

Adjusted Sales = 
VAR CurrentMonth = MAX('Date'[Month])
VAR SalesValue = CALCULATE(
MAX('SalesTable'[Sales]),
'Date'[Month] <= CurrentMonth
)
RETURN SalesValue
Adjusted Target = 
VAR CurrentMonth = MAX('Date'[Month])
VAR TargetValue = CALCULATE(
MAX('SalesTable'[Target]),
'Date'[Month] <= CurrentMonth
)
RETURN TargetValue
Adjusted % Achievement = 
DIVIDE([Adjusted Sales], [Adjusted Target], 0)

Ensure that your date table has a continuous monthly sequence so that the calculation fills forward correctly.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

shafiz_p
Super User
Super User

Hi @reggieveggie Try below codes:

Adjusted Sales:

AdjustedSales = 
CALCULATE(
    SUM(FactSales[Sales]),
    ALLSELECTED('Calendar'[Month])
)

Adjusted Target:

AdjustedTarget = 
CALCULATE(
    SUM(FactSales[Target]),
    ALLSELECTED('Calendar'[Month])
)

Adjusted % Achievement:

AdjustedAchievement = 
DIVIDE(
    [AdjustedSales],
    [AdjustedTarget],
    0
)

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.