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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
DCampbellTSS
New Member

Assistance with distribution in formula

I am currently working on a formula that was given to me for weighing items based on a designated Option. I have it working but only for the initial quarter, it doesn't distribute out to the rest of the quarters in the year. I am currenly only getting the Project Start Date and End date, I used the Start Date but recognized my error when the other quarters weren't reporting any data. Does anyone have any ideas on an approach to distribute based on quarters even though I only have a start and end date? 

 

Schedule Weight = SWITCH(TRUE(),
[cost_budget_properties.value] = "Option 1",
IF([admin_projects.start_date] = 1, 0.25 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 2, 0.25 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 3, 0.25 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 4, 0.25 * [cost_budgets.quantity], 0)))),
[cost_budget_properties.value] = "Option 2",
IF([admin_projects.start_date] = 1, 0.50 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 2, 0.10 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 3, 0.10 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 4, 0.30 * [cost_budgets.quantity], 0)))),
[cost_budget_properties.value] = "Option 3",
IF([admin_projects.start_date] = 1, 0.75 * [cost_budgets.quantity],
IF([admin_projects.start_date] = 2, 0,
IF([admin_projects.start_date] = 3, 0,
IF([admin_projects.start_date] = 4, 0.25 * [cost_budgets.quantity], 0)))),
0
)
1 REPLY 1
Fowmy
Super User
Super User

@DCampbellTSS 

Please try this modifed version where both start and end dates are considered:

Schedule Weight = 
VAR StartQtr = QUARTER([admin_projects.start_date])
VAR EndQtr = QUARTER([admin_projects.end_date])
VAR TotalQuarters = EndQtr - StartQtr + 1
VAR CurrentQtr = SELECTEDVALUE('Calendar'[Quarter])

RETURN
IF(
    StartQtr <= CurrentQtr && CurrentQtr <= EndQtr, 
    SWITCH(
        TRUE(),
        [cost_budget_properties.value] = "Option 1", 
            (1 / TotalQuarters) * [cost_budgets.quantity],
        
        [cost_budget_properties.value] = "Option 2",
            LOOKUPVALUE(Option2Weights[Weight], Option2Weights[Quarter], CurrentQtr) * [cost_budgets.quantity],
        
        [cost_budget_properties.value] = "Option 3",
            LOOKUPVALUE(Option3Weights[Weight], Option3Weights[Quarter], CurrentQtr) * [cost_budgets.quantity],
        
        0
    ),
    0
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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