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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to use an else if or have a default function in this measure

Sorry for the vague title but it was difficult to word. 

To start off with, on my report I have a slicer and a card. As shown below:

KyleAdam_1-1630896053678.png

 

 

As you can see the Card is currently blank, which is a problem. This is because I have a measure in the card that only shows up when a Deal is selected on the slicer. 

This is the measure below, that a kind user on here gave me:

DealPO =
VAR _POTotal = [VO PO Total]
VAR _POBilled = [PO Billed]
RETURN
if( isfiltered('Deals (CRM)'[Deal Name]) ,
SUMX (
VALUES ( 'Deals (CRM)'[Deal Name] ),
IF ( ISBLANK ( _POTotal ), _POBilled, _POTotal )
) , blank())
 
This works perfectly fine for the Deal slicer by the way, the maths isn't an issue. However, when a Deal isn't selected, I want the card to just display [PO Billed]. I've been trying for hours on implementing this but I've had no luck. I've tried ELSE statements and they don't work. How would I be able to accomplish this? 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

DealPO =
VAR _POTotal = [VO PO Total]
VAR _POBilled = [PO Billed]
RETURN
if( isfiltered('Deals (CRM)'[Deal Name]) ,
SUMX (
VALUES ( 'Deals (CRM)'[Deal Name] ),
IF ( ISBLANK ( _POTotal ), _POBilled, _POTotal )
) , _POBilled )

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try like

 

DealPO =
VAR _POTotal = [VO PO Total]
VAR _POBilled = [PO Billed]
RETURN
if( isfiltered('Deals (CRM)'[Deal Name]) ,
SUMX (
VALUES ( 'Deals (CRM)'[Deal Name] ),
IF ( ISBLANK ( _POTotal ), _POBilled, _POTotal )
) , _POBilled )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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