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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous_
Frequent Visitor

DAX_Weekly percentage

How would I write the following formulas in DAX: 

Anonymous__0-1674462267729.png

 

If you see in the last two columns, I have written the formulas and the Last column is how the Excel formula looks like, which is, Cost(a)/Sum of Cost for week 1, and so on and so forth for each product. Essentially we want to be able to find Cost Percentage per week per product. I'm not able to grasp the exact formula for this in DAX.

Thanks for the help!:)

2 REPLIES 2
FreemanZ
Community Champion
Community Champion

hi @Anonymous_ 

try to add a column like this:

Cost%2 = 
DIVIDE(
    [Cost],
    SUMX(
        FILTER(
            TableName, 
            TableName[Week]=EARLIER(TableName[Week])
        ),
        TableName[Cost]
    )
)

FreemanZ_0-1674467307444.png

if you feel more comfortable with CALCULATE, it looks like this:

Cost%3 = 
DIVIDE(
    [Cost],
    CALCULATE(
        SUM(TableName[Cost]),
        ALLEXCEPT(TableName, TableName[Week])
    )
)

FreemanZ_1-1674467482790.png

@Anonymous_ 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.