Forum Discussion
DAX not working
- Anonymous1 year ago
Hi Anees91 ,
I made simple samples and you can check the results below:Table 2 = SUMMARIZE('Table',[Category]) Measure = var _s = SELECTEDVALUE('Table 2'[Category]) var _sum = COUNT('Table'[ID]) var _total = CALCULATE(COUNT('Table'[ID]),REMOVEFILTERS('Table'[Category]),FILTER('Table',[Fail]="Yes")) var _selecet = CALCULATE(COUNT('Table'[ID]),FILTER('Table',[Fail]="Yes"&&[Category]=_s)) RETURN IF(HASONEFILTER('Table 2'[Category]),1-DIVIDE(_selecet,_sum),1-DIVIDE(_total,_sum))An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anees91
Try adjusting the formula for Service Success to use ALL instead of ALLSELECTED for the gauge visual calculation, so that the slicer context does not affect it, while still respecting the selection made in the bar chart:
Service Success =
VAR Numerator = CALCULATE(COUNT('Volume'[Failure.ConsignmentId]))
VAR Denominator =
CALCULATE(
COUNT(Volume[ConsignmentId]),
REMOVEFILTERS(Volume[Failure.SFCCode]),
KEEPFILTERS(ALLSELECTED(Volume[Failure.SFCCode])) // Keeps filter for failure codes
)
VAR DenominatorGauge =
CALCULATE(
COUNT(Volume[ConsignmentId]),
REMOVEFILTERS(Volume[Failure.SFCCode]),
ALL(Volume[Date]) // Removes the date slicer filter context for gauge visual
)
RETURN
IF(
Denominator = 0,
BLANK(),
1 - (Numerator / Denominator)
)
Please consider:
- If you are using multiple slicers or complex filtering, ensure that the right context is applied for both your chart and gauge visual.
- You may also need to check the interactions between the visuals to ensure the slicer and filters are behaving as expected (especially for the gauge visual).
This approach should resolve the issue with the gauge visual not updating correctly when clicking on failure codes in the bar chart while still respecting the slicer for the combo chart.
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS