The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello All,
I have a case which is problematic for me. I have a valuse with target. Untill any filtere is not applied then I'd like to see a line with target 90% but If I will apply filter based on slicer or choosing something in the matrix, I'd like to see specific valuse for this line with target lince dedicated for this line. I'm trying to use below DAX code but it isn;t work:
Scores Target =
VAR Plant_target = 0.9
VAR Corporate_target = MAX('Cust Satisfaction'[Target])
RETURN
IF( FILTER('Cust Satisfaction'),Plant_target,Corporate_target)
Solved! Go to Solution.
It looks like you're trying to create a measure that dynamically sets the target value based on whether any filters are applied. The DAX code you provided is close, but there are some issues with the syntax. You can achieve this by using a combination of ISFILTERED and HASONEVALUE functions to determine if filters are applied and then select the appropriate target value. Here's the corrected DAX code:
Scores Target =
VAR Plant_target = 0.9
VAR Corporate_target = MAX('Cust Satisfaction'[Target])
VAR Filtered = ISFILTERED('Cust Satisfaction')
RETURN
IF (
Filtered,
IF (
HASONEVALUE('Cust Satisfaction'[YourFilterColumn]), -- Replace with your actual filter column
Corporate_target, -- Specific target when a filter is applied
BLANK() -- No specific target when multiple filter values are selected
), Plant_target -- Default target when no filters are applied )
Replace 'Cust Satisfaction'[YourFilterColumn] with the actual column you are using in your filter/slicer. This code checks if filters are applied. If filters are applied, it checks if only one filter value is selected; if so, it uses the corporate target; otherwise, it returns BLANK() (no specific target). If no filters are applied, it uses the plant target.
Make sure to adjust the column and table names to match your data model. This measure should dynamically change the target value based on the presence of filters and the selection of filter values.
Hello,
I don't want to replicate the same topic so I'm writing here.
I have modified a bit above DAX to be aligne with 12months or 36months data and generate trend.
Unfortuantely, It's not working and target are different. Can some help me to clear up below DAX ?
Score Target =
VAR MaxDate =
MAX ( 'DATE_DUP'[WC_Month] )
VAR MinDate =
DATE ( YEAR ( MaxDate ), MONTH ( MaxDate ) - MAX (DATE_DUP[TotalMonths] ), DAY ( MaxDate ) )
RETURN
CALCULATE (
IF(
ISFILTERED('Master Corporation'[Corporation]),
MAX('Cust Satisfaction'[Target]),
0.9
),
FILTER ( 'COQ Calendar', 'COQ Calendar'[WC_Month] > MinDate && 'COQ Calendar'[WC_Month] <= MaxDate )
)
It looks like you're trying to create a measure that dynamically sets the target value based on whether any filters are applied. The DAX code you provided is close, but there are some issues with the syntax. You can achieve this by using a combination of ISFILTERED and HASONEVALUE functions to determine if filters are applied and then select the appropriate target value. Here's the corrected DAX code:
Scores Target =
VAR Plant_target = 0.9
VAR Corporate_target = MAX('Cust Satisfaction'[Target])
VAR Filtered = ISFILTERED('Cust Satisfaction')
RETURN
IF (
Filtered,
IF (
HASONEVALUE('Cust Satisfaction'[YourFilterColumn]), -- Replace with your actual filter column
Corporate_target, -- Specific target when a filter is applied
BLANK() -- No specific target when multiple filter values are selected
), Plant_target -- Default target when no filters are applied )
Replace 'Cust Satisfaction'[YourFilterColumn] with the actual column you are using in your filter/slicer. This code checks if filters are applied. If filters are applied, it checks if only one filter value is selected; if so, it uses the corporate target; otherwise, it returns BLANK() (no specific target). If no filters are applied, it uses the plant target.
Make sure to adjust the column and table names to match your data model. This measure should dynamically change the target value based on the presence of filters and the selection of filter values.
Thanks for quick respons. It's work.