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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Cyriackpazhe
Helper III
Helper III

calculated column

Screenshot (24).pngWhen i write a calculated column like the above, shouldn't the same value be displayed in each row since there is no filter context and all distinct values of Sales[orderdate] will be considered the virtual table. 

1 ACCEPTED SOLUTION
quantumudit
Super User
Super User

Hello @Cyriackpazhe 

 

Here is the DAX you have used to create the calculated column in the table:

Col = SUMX(
    VALUES(Sales[OrderDate]),
    Sales[SalesAmount]
)

 

The issue with the above DAX formula is as follows:

 

 

  • VALUES(Sales[OrderDate]) returns all distinct dates from the entire Sales table in the current context (which, in a calculated column, is usually the whole table).

  • SUMX iterates over that list of dates, creating a row context for each distinct date. However, because you’re using Sales[SalesAmount] without a CALCULATE or filter, DAX does not automatically filter Sales[SalesAmount] to that single date.

  • Result: For each distinct date in VALUES(Sales[OrderDate]), DAX is still seeing the single row context of the calculated column. The net effect is that you often end up with a sum (SalesAmount in the current row) multiplied by the count of distinct dates (in the entire table).

 

If you want the sum of SalesAmount by each date within that iteration, you’d typically wrap it in CALCULATE, for example:

 

Col = CALCULATE(
    SUM(Sales[SalesAmount]),
    FILTER(
        Sales,
        Sales[OrderDate] = EARLIER(Sales[OrderDate])
    )
)

 

You may also use VAR and RETURN instead of EARLIER() as well

 

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

 

 

 

 

 

View solution in original post

1 REPLY 1
quantumudit
Super User
Super User

Hello @Cyriackpazhe 

 

Here is the DAX you have used to create the calculated column in the table:

Col = SUMX(
    VALUES(Sales[OrderDate]),
    Sales[SalesAmount]
)

 

The issue with the above DAX formula is as follows:

 

 

  • VALUES(Sales[OrderDate]) returns all distinct dates from the entire Sales table in the current context (which, in a calculated column, is usually the whole table).

  • SUMX iterates over that list of dates, creating a row context for each distinct date. However, because you’re using Sales[SalesAmount] without a CALCULATE or filter, DAX does not automatically filter Sales[SalesAmount] to that single date.

  • Result: For each distinct date in VALUES(Sales[OrderDate]), DAX is still seeing the single row context of the calculated column. The net effect is that you often end up with a sum (SalesAmount in the current row) multiplied by the count of distinct dates (in the entire table).

 

If you want the sum of SalesAmount by each date within that iteration, you’d typically wrap it in CALCULATE, for example:

 

Col = CALCULATE(
    SUM(Sales[SalesAmount]),
    FILTER(
        Sales,
        Sales[OrderDate] = EARLIER(Sales[OrderDate])
    )
)

 

You may also use VAR and RETURN instead of EARLIER() as well

 

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

 

 

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.