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
Kadrimedquali
Helper I
Helper I

Sum of column with condition

Hi,

Good Day!

i have a dataset, i would like calculat the sum of column (Mnt Transport) but for each (N° Expédition).

fILE : link 

exemple :

for month August , the sum of Mnt transport is 382500, is not 10420200 as in the file, because the amount of (Mnt Transport )is redoubled for each row.

Sum of August is 4500+(43200*7)+(37080*2) =382500

 

Capture d’écran 2021-11-23 203259.png

 

many thinks

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Kadrimedquali 

 

Sum of August is 4500+(43200*7)+(37080*2) =>>4500+302400+74160=381060

 

try to create a measure like this:

Measure = 
var _t1=SUMMARIZE('Base export',[Date Expédition].[Mois],[Transporteur],"1",DISTINCTCOUNT('Base export'[N° Expédition]),"2",AVERAGE('Base export'[Mnt Transport]))
var _t2=ADDCOLUMNS(_t1,"3",[1]*[2])
return SUMX(_t2,[3])

 Result:

vangzhengmsft_0-1637895673024.png

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-angzheng-msft
Community Support
Community Support

Hi, @Kadrimedquali 

 

Sum of August is 4500+(43200*7)+(37080*2) =>>4500+302400+74160=381060

 

try to create a measure like this:

Measure = 
var _t1=SUMMARIZE('Base export',[Date Expédition].[Mois],[Transporteur],"1",DISTINCTCOUNT('Base export'[N° Expédition]),"2",AVERAGE('Base export'[Mnt Transport]))
var _t2=ADDCOLUMNS(_t1,"3",[1]*[2])
return SUMX(_t2,[3])

 Result:

vangzhengmsft_0-1637895673024.png

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

Kadrimedquali
Helper I
Helper I

i need help

thank you

Kadrimedquali
Helper I
Helper I

hi @VahidDM 

thank you for your colaboration

link of the file link 

VahidDM
Super User
Super User

HI @Kadrimedquali 

 

I can't downoad the file (need Access), can you share that on https://gofile.io/

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

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.