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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Community Champion
Community Champion

@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
Resident Rockstar
Resident Rockstar

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.