Hello,
My problem is quite complex with a large database but I have simplified the thing to explain to you.
In the datasource "Gestion" :
| Famille d'achat | Procédure applicable | Procédure utilisée | Montant HT |
| France | 1 | A | 5 |
| Spain | 2 | B | 1 |
| Germany | 1 | A | 2 |
| Germany | 1 | C | 3 |
| France | 1 | A | 1 |
| Spain | 2 | C | 10 |
| Germany | 1 | D | 10 |
| France | 1 | D | 1 |
| France | 1 | B | 2 |
I wish to have this result in my gallery:
| Famille d'achat | Procédure applicable | Expenses | Expenses if A |
| France | 1 | 9 | 6 |
| Spain | 2 | 11 | - |
| Germany | 1 | 15 | 1 |
In column 1, I want to group by "Famille d'achat" (So I used GroupBy).
In column 2, as you can see the "Procédure applicable" is the same for the same "Famille d'achat".
Then in column 3, "Expenses", I want to add all the "Montant HT" of the same family. (sum)
In column 4, the sum of all "Montant HT" if "Procédure utilisée" = A. Otherwise put "-".
So, in gallery.item :
With(
{
groupByFamille:
GroupBy(
Filter(
Gestion;
(
Len(ddBudg_2.Selected.Value) = 0 ||
'Exercice budgétaire' = ddBudg_2.Selected.Value)
&& (
Len(ddSociété_2.Selected.Value) = 0 ||
Société = ddSociété_2.Selected.Value
)
);
"Famille_x0020_d'achat";
"Procédure_x0020_applicable";
"Procédure_x0020_utilisée";
"Result"
)
};
AddColumns(
groupByFamille;
"Expenses";
Sum(
Result;
'Montant HT'
);
"Expenses if A";
If(
Procédure_x0020_utilisée = "A";
"-";
Sum(
Result;
'Montant HT'
)
)
)
)Don't worry about the filter.
This code works but displays too many rows.
Indeed, I would like to sort only by "Famille_x0020_d'achat"
but if I delete the lines:
"Procédure_x0020_applicable";
"Procédure_x0020_utilisée";
This does not work because in "Expenses if A", "Procédure_x0020_utilisée" is not recognized.
and it's impossible to create the column "Procédure applicable" in gallery.
I hope it's easier to understand than the old topic I created.
Hoping someone unlocks me ...
Thanks in advance !

Report
All responses (
Answers (