Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Min/Max Marker in Linechart

Hi

 

I have two questions regarding Min and Max Markers in a linechart. I followed a guide on youtube to add Min/Max Markers in a linechart and id worked correctly. However, I'd like to adjust it to my personal needs, but am struggeling with it.

For the Min/Max Markers I used the following measure
Customer MaxMarker =
Var Customer = [Customer order]
Var MaxCustomer=
MAXX(
ALLSELECTED(dimDate[Year],dimDate[Week]),
[Customer order]
)
Var MinCustomer=
MINX(
ALLSELECTED(dimDate[Year],dimDate[Week]),
[Customer order]
)
Var result =
SWITCH(
TRUE(),
Customer = MaxCustomer="Green",
Customer = MinCustomer=, "Red",
"Black"
)
RETURN result

 

Question 1: In my linechart I would like to highlight the Min and Max Markers depending on the Drilldown State. I'm pretty sure I have to adjust it in the ALLSELECTED line, but I cant figure out how.

 

Question 2:

When I have two lines in my chart from separate measures and then switch to bar chart to set up the conditional formatting for the Min/Max Markers, the field for conditional formatting dissapears

Is there any workaround to highlight the min/max for each of these lines?

 

Thanks in advance for the help

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

    For the first question, you can refer  change your measure to the following, and my date hierarchy is year-week-date 

    MEASURE =
    VAR _maxdata =
        IF (
            ISINSCOPE ( dimDate[Date] ),
            MAXX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
            IF (
                ISINSCOPE ( dimDate[Week] ),
                MAXX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                MAXX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
            )
        )
    VAR _mindata =
        IF (
            ISINSCOPE ( dimDate[Date] ),
            MINX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
            IF (
                ISINSCOPE ( dimDate[Week] ),
                MINX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                MINX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
            )
        )
    RETURN
        SWITCH (
            TRUE (),
            [Customer order] = _maxdata, "green",
            [Customer order] = _mindata, "red",
            "black"
        )
    

    Output (I set the data label color)

    date level

    week level

    Year level

     

    For the second question, becasue you have two measures in the y-axis, so it has the label, you can not set the chart color by conditionfal formatting, you can only change the chart color manually, so it is better that set the data label color, it can use the conditionfal formatting.

     

     

    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.

     

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    For the first question, you can refer  change your measure to the following, and my date hierarchy is year-week-date 

    MEASURE =
    VAR _maxdata =
        IF (
            ISINSCOPE ( dimDate[Date] ),
            MAXX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
            IF (
                ISINSCOPE ( dimDate[Week] ),
                MAXX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                MAXX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
            )
        )
    VAR _mindata =
        IF (
            ISINSCOPE ( dimDate[Date] ),
            MINX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
            IF (
                ISINSCOPE ( dimDate[Week] ),
                MINX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                MINX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
            )
        )
    RETURN
        SWITCH (
            TRUE (),
            [Customer order] = _maxdata, "green",
            [Customer order] = _mindata, "red",
            "black"
        )
    

    Output (I set the data label color)

    date level

    week level

    Year level

     

    For the second question, becasue you have two measures in the y-axis, so it has the label, you can not set the chart color by conditionfal formatting, you can only change the chart color manually, so it is better that set the data label color, it can use the conditionfal formatting.

     

     

    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.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Anonymous 

      Thanks for your response and help. Its working so far.

      Because my date hierarchy is Year , Month, Week, Date I tried to add the month by myself but somehow I'm making something wrong (beginner, sorry :() 
      For the max I did it like this:

      VAR _maxdata =
          IF (
              ISINSCOPE ( dimDate[Date] ),
              MAXX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
          	IF (
              	ISINSCOPE ( dimDate[Week] ),
             		MAXX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
              		IF (
                  			ISINSCOPE ( dimDate[Monthname] ),
                  			MAXX ( ALLSELECTED ( dimDate[Monthname] ), [Customer order] ),
                 			MAXX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
              )
          )
      )

      But its showing green for every month.
      I created the Datetable in PowerQuery and I'm having a column MonthNo for the correct sortorder for my Monthname. Is it possible that the error has something to do with that or did I just something wrong in the measure?

      Best regards

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous 

        Thanks for your quickly reply, if you put the monthname to the scope, you need to make sure that you have put the monthname to the  hierarchy, you can refer to the following picture.

        Then you can change the code to the following,

         

        MEASURE =
        VAR _maxdata =
            IF (
                ISINSCOPE ( dimDate[Date] ),
                MAXX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
                IF (
                    ISINSCOPE ( dimDate[Week] ),
                    MAXX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                    IF (
                        ISINSCOPE ( dimDate[MonthName] ),
                        MAXX ( ALLSELECTED ( dimDate[MonthName] ), [Customer Order] ),
                        MAXX ( ALLSELECTED ( dimDate[Year] ), [Customer Order] )
                    )
                )
            )
        VAR _mindata =
            IF (
                ISINSCOPE ( dimDate[Date] ),
                MINX ( ALLSELECTED ( dimDate[Date] ), [Customer order] ),
                IF (
                    ISINSCOPE ( dimDate[Week] ),
                    MINX ( ALLSELECTED ( dimDate[Week] ), [Customer order] ),
                    IF (
                        ISINSCOPE ( dimDate[MonthName] ),
                        MINX ( ALLSELECTED ( dimDate[MonthName] ), [Customer Order] ),
                        MINX ( ALLSELECTED ( dimDate[Year] ), [Customer order] )
                    )
                )
            )
        RETURN
            SWITCH (
                TRUE (),
                [Customer order] = _maxdata, "green",
                [Customer order] = _mindata, "red",
                "black"
            )
        

         

        It can work

        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.