Using Parameters in IF-THEN-ELSE statements in PBI

Used for anything related to the new Power BI Desktop and Service tools
gs0706
Posts: 2
Joined: Sat Feb 17, 2018 5:20 am

Using Parameters in IF-THEN-ELSE statements in PBI

Postby gs0706 » Sat Feb 17, 2018 7:06 am

I'm trying to figure out how to incorporate a parameter inside an IF-THEN-ELSE statement in PBI in order to 'calculate' different outcomes for specific times of the year (monthly, YTD and EOY). See current code (not in PBI obviously) below:

Target Energy Month=
IF (REPORT_MONTH EQ &REPORT_MONTH AND REPORT_YEAR EQ &REPORT_YEAR )
THEN TargetMonthlyTotalEnergy ELSE 0;

Target Energy YTD/=IF (REPORT_MONTH LE &REPORT_MONTH AND REPORT_YEAR EQ &REPORT_YEAR )
THEN TargetMonthlyTotalEnergy ELSE 0;

Target Energy EOY=IF (REPORT_YEAR EQ &REPORT_YEAR )
THEN TargetMonthlyTotalEnergy ELSE 0;

I've looked at various places on the web but I can't find anything specific to my need utilizing parameters. Also I'm not positive this should be an IF-THEN-ELSE statement? Maybe an 'IF-AND' - IF(AND([REPORT_MONTH] = ? Do I need to create parameters? I'm completely at a loss here.

This is my first blog EVER so please forgive me if I'm made any blatant rookie errors.
Attachments
Parameters in IF-THEN-ELSE Statements.docx
(30.61 KiB) Downloaded 48 times

Return to “Power BI Desktop/Service”

Who is online

Users browsing this forum: No registered users and 1 guest

cron