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

Help With DAX For Table Visual

Hi,

 

I have an existing function that's not returning correct results. Appreciate any help please @amitchandak @Jihwan_Kim 

 

 

X Proc Resc (Format) = 
var _val = [X Proc Resc]
var _test = [X Del Resc] + [X Carryover] + [X Aged Freight]
return

SWITCH(TRUE(),
_test >=0 && _val >=0, FORMAT(_val, "##0.0%"),
_test >=0 && _val =BLANK(), FORMAT(_val, "General Number"))

 

 

qsmith83_0-1659411490203.png

 

As per screenshot, the expected results for the highlighted "Branch" column should be:

BranchX Del RescX Proc RescX Proc Resc (Format)X CarryoverX Aged Freight
Auckland South     
Auckland West0.0%50.0%50.0%  
Blenheim  0 0
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@lbendlin yes you're right and I forgot to mention that. So I've managed to solve my issue by tweaking the dax and it's showing expected results.

X Proc Resc (Format)1 = 
var _val = [X Proc Resc]
var _test = [X Del Resc] + [X Carryover] + [X Aged Freight]
var _result =
SWITCH(TRUE(),
NOT(ISBLANK(_test)) && NOT(ISBLANK(_val)), FORMAT(_val,"##0.0%"),
NOT(ISBLANK(_test)) && ISBLANK(_val), FORMAT(0, "General Number"))

return
_result

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

You can't report on things that aren't there unless you perform extra steps like adding 0 to the measure or using disconnected tables and cross joins.

Anonymous
Not applicable

@lbendlin yes you're right and I forgot to mention that. So I've managed to solve my issue by tweaking the dax and it's showing expected results.

X Proc Resc (Format)1 = 
var _val = [X Proc Resc]
var _test = [X Del Resc] + [X Carryover] + [X Aged Freight]
var _result =
SWITCH(TRUE(),
NOT(ISBLANK(_test)) && NOT(ISBLANK(_val)), FORMAT(_val,"##0.0%"),
NOT(ISBLANK(_test)) && ISBLANK(_val), FORMAT(0, "General Number"))

return
_result

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.

Top Solution Authors