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
Not applicable

Help with SUMX on Measures Column

Sumx on Measures not working for me

 

I need a quick dax help here.

 

 

         
Sales        
 ItemCol1Col2col2Col4Col3 DIFF
 A103123036 -6
 B2061412084 36
 C25421008 92
 D106146084 -24
 E1742688 60
         
         

 

On Sales table.

Assume that Col 3 and col 4 are derived and formular is unknown.  

The Ask is to determine    Total Price Decline (Diff) = Col4 – Col3,
Filtered to only customers having Diff value of less than 0

 

My issue is that I am not failiar with using Sumx on measures. 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Diff measure: = 
VAR _newtable =
    FILTER (
        ADDCOLUMNS (
            VALUES ( Sales[Item] ),
            "@diff", [Col4 measure:] - [Col3 measure:]
        ),
        [@diff] < 0
    )
RETURN
    IF ( HASONEVALUE ( Sales[Item] ), SUMX ( _newtable, [@diff] ) )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

Whether the advice given by @Jihwan_Kim  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Diff measure: = 
VAR _newtable =
    FILTER (
        ADDCOLUMNS (
            VALUES ( Sales[Item] ),
            "@diff", [Col4 measure:] - [Col3 measure:]
        ),
        [@diff] < 0
    )
RETURN
    IF ( HASONEVALUE ( Sales[Item] ), SUMX ( _newtable, [@diff] ) )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

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.