Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Keep right formatting at slicer

Hi,

I have a bar chart with a slicer. This slicer contains several measures with Currencies, Percentages and numerical values. 
The blue line is the delta % in comparison to last year. 

 

The issue is that the left y-axis does not contain the right formatting (currency/percentage or numerical) with the current method. I tried to use solutions in this link: https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-FORMAT-with-SWITCH/m-p/1396503 , but it did not work out. 
Also, I tried to use this link https://amitchandak.medium.com/power-bi-power-bi-create-dynamic-slicers-using-field-parameters-202587d4dedb
This works, however I am unable to use this for the Delta % measure. The DAX for the Delta % can you see below. 

Delta % YoY = 
VAR CurrentYear = SELECTEDVALUE('Date'[Year])
VAR Period = SELECTEDVALUE('Date'[Period])
VAR PreviousYear = SELECTEDVALUE('Date'[Year])-1

VAR CurrentPeriodMetric = CALCULATE([Selected KPI],
    FILTER(ALL('Date'),
        'Date'[Year] = CurrentYear &&
         'Date'[Period] = Period))

VAR PreviousYearSamePeriodMetric = CALCULATE([Selected KPI],
    FILTER(ALL('Date'),
        'Date'[Year] = PreviousYear &&
         'Date'[Period] = Period))

RETURN (CurrentPeriodMetric-PreviousYearSamePeriodMetric)/PreviousYearSamePeriodMetric



Can someone help me out

 

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    It seems that what you are trying to create is a line and column chart. The left Y-axis represents the range of field values for the Column y-axis (that is [Selected KPI]), while the right Y axis represents the range of column values for the Line y-axis (that is [Delta % YoY]). Now your left Y-axis is not formatted correctly, so what is the correct format? Do you want to display it as a percentage format? If yes, please select the field which put on Column y-axis and set the data format with percentage just as below screenshot.

    Best Regards

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, 
    Thanks but the values on the left axis are dynamic through a slicer with several different measures. These measures are currencies, percentages and numbers.