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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
achrafkasmi
Helper I
Helper I

calculate the SUM of a mesure in Directquery mode

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

 
 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @achrafkasmi ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_1-1676616704528.png

(2) We can create two measures. 

BESOIN PF = MIN('Table (2)'[OnHand])-MIN('Table (2)'[qtsdemandé])
Measure 2 = SUMX('Table (2)','Table (2)'[BESOIN PF])

(3) Then the result is as follows.

vtangjiemsft_2-1676616802496.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @achrafkasmi ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_1-1676616704528.png

(2) We can create two measures. 

BESOIN PF = MIN('Table (2)'[OnHand])-MIN('Table (2)'[qtsdemandé])
Measure 2 = SUMX('Table (2)','Table (2)'[BESOIN PF])

(3) Then the result is as follows.

vtangjiemsft_2-1676616802496.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

achrafkasmi
Helper I
Helper I

any help please ?

achrafkasmi
Helper I
Helper I

I’ll explain, the [BESOIN PF] is need is the current stock less the need for current orders and this is the formula :

 

BESOIN PF = 
MIN('V_QTSDAMA'[OnHand])-min('V_QTSDAMA'[qtsdemandé])

Thanks, 

 

ACHRAF KASMI

FreemanZ
Super User
Super User

Hi @achrafkasmi 

how is  [BESOIN PF] defined?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.