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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.