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
evebarratt
Helper I
Helper I

Gauge visual with slicer for actual vs target

Hi,

I used below dax to compare target with actual numbers in a default gauge visual.

 

------------------------------------------------------------------------------------------------------

Target by Consultant =
var Consultant = SELECTEDVALUE('table1'[Consultant Name])
return
CALCULATE(SUM('Table 2'[Target]),'Table 2'[Consultant]=Consultant)

------------------------------------------------------------------------------------------------------

and there is a slicer linked to 'table1'[Consultant Name] so i can filter other visuals by consultants.

 

The problem is that when I select one consultant, target is working but if the selection is all or more than 1 consultant, Gauge doesn't show the target.

 

Anyone can help?

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@evebarratt 

I believe you do not have a relationship between these two table, 

You can modify your meaure as follows:

Target by Consultant =
CALCULATE(
    SUM('Table 2'[Target]),
    KEEPFILTERS(TREATAS( VALUES( 'table1'[Consultant Name] ), 'Table 2'[Consultant]))
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@evebarratt 

I believe you do not have a relationship between these two table, 

You can modify your meaure as follows:

Target by Consultant =
CALCULATE(
    SUM('Table 2'[Target]),
    KEEPFILTERS(TREATAS( VALUES( 'table1'[Consultant Name] ), 'Table 2'[Consultant]))
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

There is a relationship between 2 tables but i think because of SELECTEDVALUE it wasn't working. Your new measure is working. Thank you!

VahidDM
Super User
Super User

Hi @evebarratt 

 

Is there any relationship between Table1 and Table2? if there is a relationship between 'table1'[Consultant Name] and 'Table 2'[Consultant], just use SUM('Table 2'[Target]).

The problem is, SELCTEDVALUE works if you select only one value; otherwise, it shows blank. 

 

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

Appreciate your Kudos!!

 

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.