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
EaglesTony
Helper V
Helper V

How do I show 2 columns in a query table in a text box instead of the table visual?

Hi,

 

  I have the following in a table:

 

Green  50

Yellow  20

Red      100

 

  I don't want to show this on the report as a table, but as text as such:

 

"Total Green: 50"

"Total Yellow: 20"

"Total Red: 100"

 

Thanks

1 ACCEPTED SOLUTION

The issue was the columns needed flipped around.

Measure = var a="Green" 
var b="Yellow"
 var c="Red" 
var _avalue =LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],a) 
var _bvalue=LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],b) 
var _cvalue=LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],c) 
return "Total"&" "&a&":"&" "&_avalue&UNICHAR(10)&
"Total"&" "&b&":"&" "&_bvalue&UNICHAR(10)&
"Total"&" "&c&":"&" "&_cvalue

View solution in original post

6 REPLIES 6
EaglesTony
Helper V
Helper V

Hi,

 

  I tried your suggestion, but getting a syntax error "The syntax for "Total" is incorrect.

 

  Here is what I have:

Measure = var a="Green" var b="Yellow" var c="Red" var _avalue =LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],a) var _bvalue=LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],b) var _cvalue=LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],c) "Total"&" "&a&":"&" "&_avalue&UNICHAR(10)&
"Total"&" "&b&":"&" "&_bvalue&UNICHAR(10)&
"Total"&" "&c&":"&" "&_cvalue

Hi @EaglesTony 

You need to add "return ", you can refer to the following measure

Measure = var a="Green" 
var b="Yellow"
 var c="Red" 
var _avalue =LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],a) 
var _bvalue=LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],b) 
var _cvalue=LOOKUPVALUE(Append1[AgingDaysColor],Append1[Count],c) 
return "Total"&" "&a&":"&" "&_avalue&UNICHAR(10)&
"Total"&" "&b&":"&" "&_bvalue&UNICHAR(10)&
"Total"&" "&c&":"&" "&_cvalue

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I tried this but when I put the field to the card, I am getting an error:

 

EaglesTony_0-1683026415170.png

AgingDaysColor is Text, Count is a Whole Number

The issue was the columns needed flipped around.

Measure = var a="Green" 
var b="Yellow"
 var c="Red" 
var _avalue =LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],a) 
var _bvalue=LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],b) 
var _cvalue=LOOKUPVALUE(Append1[Count],Append1[AgingDaysColor],c) 
return "Total"&" "&a&":"&" "&_avalue&UNICHAR(10)&
"Total"&" "&b&":"&" "&_bvalue&UNICHAR(10)&
"Total"&" "&c&":"&" "&_cvalue
lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

v-xinruzhu-msft
Community Support
Community Support

Hi @EaglesTony 

Based on the sample data you provide, you can refer to the following measures (if there is less data).

Measure = var a="Green"
var b="Yellow"
var c="Red"
var _avalue=LOOKUPVALUE('Table'[Column2],'Table'[Column1],a)
var _bvalue=LOOKUPVALUE('Table'[Column2],'Table'[Column1],b)
var _cvalue=LOOKUPVALUE('Table'[Column2],'Table'[Column1],c)
return "Total"&" "&a&":"&" "&_avalue&UNICHAR(10)&
"Total"&" "&b&":"&" "&_bvalue&UNICHAR(10)&
"Total"&" "&c&":"&" "&_cvalue

Then put the measure to the card visual

vxinruzhumsft_0-1682906754931.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.