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
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
Super User
Super User

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
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.