Forum Discussion

Cyriackpazhe's avatar
Cyriackpazhe
Helper III
1 year ago
Solved

Calculated column

My intention is to produce the total sales of each day in each row. But here I'm only getting the values of the respective rows in the column. What is the issue with the above code
  • quantumudit's avatar
    1 year ago

    Hello Cyriackpazhe 

    I don't think you need MAX() function, i.e., you can just use the following:

     

     

    VAR Maxxx = Sales[Order Date]

     

     

    Also in the FILTER(), use the entire table instead and not just the Sales[Order Date] column and no need to use ALL() function.

     

    Could you please try doing this small change and see if you are getting the desired results or, not.

     

    Here is one of the example DAX:

    Col = 
    VAR Maxxx = financials[Date]
    VAR Total = CALCULATE(
        SUM(financials[ Sales]),
        FILTER(
            financials,
            financials[Date] = Maxxx
        )
    )
    RETURN
    Total

     

    I am also attaching a sample report for your reference.

     

    Best Regards,
    Udit

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudo 👍

    🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
    Visit My Linktree: LinkTree

     

    Proud to be a SuperUser

  • quantumudit's avatar
    quantumudit
    1 year ago

    Hi Cyriackpazhe 

     

    I'm questioning the sales figure of 3578.28 for that date. Since that's the only sale listed, could you double-check by filtering the Order Date?

     

    If possible, sharing a PBIX file with anonymized data would be very helpful.

     

    My concern stems from how the FILTER() function works. It creates a virtual table. Using just the Order Date column doesn't inherently link to sales.

     

    We need to create that filtered virtual table and then sum the sales within it. That's why the claim of 3578.28 being the only sale on that date seemed potentially inaccurate.

     

    Thanks,

    Udit