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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
achrafkasmi
Helper I
Helper I

calculate the SUM of a mesure in Directquery

Hello,

 

i have a table named "V_QTSDAMA" and I have a column named "ItemName"  with a repeating products with its own stock.

 

I need to calculate the sum of " BESOIN PF " for each product. ( to not to have the products repeating themselves)

 

PS : note that the column "BESOIN PF" it's calculated as a Mesure.

 

- i work on a directquery Mode.

 

achrafkasmi_0-1675342776607.png

 

For exemple this is result that I want  , i made it on excel : 

 
 

Capture d’écran 2023-02-02 150534.png

 

Thanks, 

 

ACHRAF KASMI

 

 

 
 

 

3 REPLIES 3
achrafkasmi
Helper I
Helper I

hello all ,

 

can someone help ?

 

thanks,

johnt75
Super User
Super User

You can try

Total of products =
VAR ProductsWithValues =
    ADDCOLUMNS ( VALUES ( 'V_QTSDAMA'[ItemName] ), "@value", [BESOIN PF] )
VAR Result =
    SUMX ( ProductsWithValues, [@value] )
RETURN
    Result

thank you for your answer, 

 

the formulate doesn’t work, she didn’t return the sum, she just returned I think the minimum and not the sum.

but with this formulate i'm able to shave the ItemName.

 

achrafkasmi_0-1675352791200.png

 

thanks,

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.