Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to create an IF statement in Power BI referencing 2 tables

Hi guys and girls,

 

I am new to power bi and im finding it rather challenging to create a measure based off 2 tables.

 

The tables i am using are Calendar(This is Dimension) and SalesMeasure(This is Fact)

 

So basically i want to create a SalesCY measure in my Fact table that indicates if the flag MTDCY_Flag = 1 then show Sales value else 0;

 

MTDCY_Flag is in Calendar table.

 

I tried to create something along the lines as ..

 

SalesCY = IF(Related('Calendar'[MTDCY_Flag = 1); 'SalesMeasures[SalesValue]; 0);

 

This doesn't work though. 

 

Thanks 

StarLord

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.
Anonymous
Not applicable

Thanks 


@Anonymous wrote:

Sounds like you could you create a calculated column to diplay where MTDCY_Flag = 1.

 

Column = IF(MTDCY[Flag] = 1, "True", "False")
 
You could then use a visual filter to filter to only "True" values which you can then narrow down to where Sales = 0.

 

 

Anonymous
Not applicable

Happy to help!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.