Forum Discussion
arvindyadav
Post Partisan
7 years agoNeed to use If Condition In Power BI Desktop.
Hi Team, I want to establish If condition in power bi which I have made in excel i.e, =if(Profit > Average Profit/Employee , Profit, Average Profit/Employee). So how I can make that type of form...
MFelix
Super User
7 years agoHi arvindyadav,
Create the following two measures:
Profict per employee =
IF (
SUM ( Sheet1[Profit] )
> CALCULATE ( AVERAGE ( Sheet1[Profit] ); ALL ( Sheet1[AM] ) );
SUM ( Sheet1[Profit] );
CALCULATE ( AVERAGE ( Sheet1[Profit] ); ALL ( Sheet1[AM] ) )
)
Total Profit =
IF (
HASONEFILTER ( Sheet1[AM] );
[Profict per employee];
SUMX (
SUMMARIZE (
ALL ( Sheet1 );
Sheet1[Date].[Month];
Sheet1[AM];
"ProfitTotal"; [Profict per employee]
);
[ProfitTotal]
)
)
The use the second one to add to your visual should work, see attached PBIX file.
Regards,
MFelix
arvindyadav
Post Partisan
7 years agoHi MFelix,
Now the total issue fixed but the average is not correct. There are 17 AM's and the total profit is 279384.88.
Then The average is 279384.88/17=16434.40. But in your case the average display as 173.85 which is not correct.
Please find the attached.
Thanks,
Arvind