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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
TCatron18
Helper II
Helper II

If Statement in Measure

Hello!

 

I've looked around but not finding a solution that works for my situation. 

 

I am trying to add a row into a matrix that has a static value for a specific column. Below is the current statement I have created; however, I am getting an error on the 'Awards'[Sender's Sr Business Unit] section, and not sure what I need to do. 

 

Total Emp Count =
VAR MinDate =
FIRSTDATE ( 'Period Table'[Date] )
VAR MaxDate =
LASTDATE ( 'Period Table'[Date] )
VAR SysGen = 1
VAR EmpCount =
CALCULATE (
COUNTROWS ( 'UPH Employee Census' ),
('UPH Employee Census'[HRDATE] >= MinDate
&& 'UPH Employee Census'[HRDATE] <= MaxDate)
)
Return
IF( 'Awards'[Sender's Sr Business Unit] = "xSystem Generated", SysGen, EmpCount - [Total Mgr Count] )
 
My expected result is to have:
Sr Business UnitTotal Emp Count
A[count]
B[count]
C[count]
xSystem Generated1
 
Thank you in advance for any assistance you can provide!
1 ACCEPTED SOLUTION
Deku
Super User
Super User

Add selectedvalue()

 

IF( selectedvalue('Awards'[Sender's Sr Business Unit] ) = "xSystem Generated",


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

6 REPLIES 6
TCatron18
Helper II
Helper II

Well that did help get it to stop erroring; however, I'm still having an issue getting to actually add that row to my matrix. 

 

Edit: I might have figured it out. Hopefully 🙂

d_m_LNK
Super User
Super User

Completely agree with @Deku.  You are getting the error because currently you are referencing the entire column of values of the 'Awards'[Sender's Sr Business) Unit] column.  Adding SelectedValue() around the column gives you a single value to evaluate in the statement within the filter context.  This has happened to me so many times 🙂

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃
Deku
Super User
Super User

Add selectedvalue()

 

IF( selectedvalue('Awards'[Sender's Sr Business Unit] ) = "xSystem Generated",


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

@Deku - I get an error. 

TCatron18_0-1742497507473.png

 

Just a Parenthses in the wrong spot.  It should read like this

 

IF(SELECTEDVALUE('Awards'[Sender's Sr Business Unit]) = "xSystem Generated", SysGen, EmpCount - [Total Mgr Count] )

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃

The = "xSystemGenerate" should be outside of the selectedvalue brackets


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.