Forum Discussion
YeonseokKim
3 years agoFrequent Visitor
Averageifs function in Power BI
I want to get average of each category(the category can be changed with filters)
For example, with the date below,
I want to get the average pallet # by each loading number.
Please advice me that how to get the average by each loading number.
*Condition
1) All pallets with same loading number must be combined
2) All data must be calculated with each loading number.
In excel, I can get the data by converting below data to pivot tabel.
And then, I can get the data by using simple average function.
But, I want to establish it in power bi automatically.
| Date | Truck plate # | Loading number | Pallet # |
| 2022-08-02 | ABCD012 | 1000001 | 3 |
| 2022-08-02 | ABCD012 | 1000001 | 4 |
| 2022-08-02 | ABCD012 | 1000001 | 2 |
| 2022-08-02 | ABCD013 | 1000002 | 1 |
| 2022-08-02 | ABCD013 | 1000002 | 3 |
| 2022-08-02 | ABCD013 | 1000002 | 4 |
| 2022-08-02 | ABCD013 | 1000002 | 5 |
| 2022-08-02 | ABCD013 | 1000002 | 2 |
| 2022-08-02 | ABCD013 | 1000002 | 3 |
| 2022-08-02 | ABCD015 | 1000003 | 4 |
| 2022-08-02 | ABCD015 | 1000003 | 5 |
| 2022-08-02 | ABCD015 | 1000003 | 2 |
| 2022-08-03 | ABCD012 | 1000004 | 3 |
| 2022-08-03 | ABCD012 | 1000004 | 1 |
| 2022-08-03 | ABCD012 | 1000004 | 3 |
| 2022-08-05 | ABCD013 | 1000005 | 3 |
| 2022-08-05 | ABCD013 | 1000005 | 2 |
| 2022-08-05 | ABCD013 | 1000005 | 3 |
Many thanks
Hi,
Please check the below picture and the attached pbix file.
Avg pallets by each loading: = AVERAGEX ( VALUES ( Data[Loading number] ), CALCULATE ( SUM ( Data[Pallet #] ) ) )
1 Reply
- Jihwan_KimSuper User
Hi,
Please check the below picture and the attached pbix file.
Avg pallets by each loading: = AVERAGEX ( VALUES ( Data[Loading number] ), CALCULATE ( SUM ( Data[Pallet #] ) ) )