## PowerBI calculation problem

Anything related to PowerPivot and DAX Formuale
charingane
Posts: 7
Joined: Mon Apr 23, 2018 10:20 pm

### PowerBI calculation problem

Hello guys,
You might have seen a couple of my post earlier where I was asking how to multiply some column with one another using this formula

If you haven’t seen it before here tis the link to that post:
viewtopic.php?f=6&t=1106
A lot among you tried to help get to the answer and I thank you all for that but I still haven’t figure it out quite yet so I need you help once again.
This time I imported my data to power BI and I added column with the following code:
Grap.Selection = CALCULATE (
PRODUCTX ( Feuil3; [1+R] );
FILTER ( ALL ( 'Feuil3' ); 'Feuil3'[Somme de index]< EARLIER ( 'Feuil3'[Somme de index] ) )
)
* CALCULATE (
PRODUCTX ( 'Feuil3'; [1+B] );
FILTER ( ALL ( 'Feuil3' ); 'Feuil3'[Somme de index] > EARLIER ( 'Feuil3'[Somme de index] ) )
)
* CALCULATE(
max([Selection]);
FILTER ( ALL ( 'Feuil3' ); 'Feuil3'[Somme de index] = EARLIER ( 'Feuil3'[Somme de index] ) )
)
Although it didn’t give me any error ... it didn’t give me the correct result and it didn’t gave me any result for the first and the last row… so any suggestion of how to actual get a correct code …this is pretty urgent so I would love for you to help if you can of course.

MattAllington
Posts: 967
Joined: Sun May 04, 2014 4:01 pm
Location: Sydney, Australia

### Re: PowerBI calculation problem

I’m willing to take a look, but can you please
1. create a sample file including your formulas
2. Change the table names and column names to English (for context)
3. Show the answer you are expecting and where it is wrong.

Matt
Matt Allington is Self Service BI Consultant, Trainer and Author of the Book "Supercharge Power BI".
Power BI Training

charingane
Posts: 7
Joined: Mon Apr 23, 2018 10:20 pm

### Re: PowerBI calculation problem

Hello,
Thanks for your time

Using a dax column in power BI I came up with the following code:
Grap. Allocation = CALCULATE (
PRODUCTX ( Table2; [1+R] );
FILTER ( ALL ( 'Table2' ); 'Table2'[ index]< EARLIER ( 'Table2'[ index] ) )
)
* CALCULATE (
PRODUCTX ( 'Table2'; [1+B] );
FILTER ( ALL ( 'Table2' ); 'Table2'[ index] > EARLIER ( 'Table2'[ index] ) )
)
* CALCULATE(
max([allocation]);
FILTER ( ALL ( 'Table2' ); 'Table2'[ index] = EARLIER ( 'Table2'[ index] ) )
)

My problem with this function is that it does not only not show results in the first and last row ….even the middle section is wrong this is the set of result that should be given (made it manually)

file link here : https://ufile.io/gfds6
file name : BI_GRAP.pbix