Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Issue with Line chart

Hi All,

 

I have to use a Line chart to show the sales unit by the date and when we select multiple stores then every store shows by separate color(Legend) as shown below:

Expected Result: But When we select All Stores it needs to show only a single line, for this, I have used following measure

AllSelected =
IF(COUNTROWS(DISTINCT(ALLSELECTED(Sales[Store]))) < COUNTROWS(DISTINCT(ALL(Sales[Store]))),
SUM(Sales[Quantity]),
CALCULATE(SUM(Sales[Quantity]),ALL(Sales[Store]))
)
 
But it shows wrong Output as below:
 
Please help me out.
 
Thanks.

4 Replies

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    Did my last reply solve your issue?

    If my answer has solved your issue, please mark it as a solution for others to see.
    Thanks!

     

    Best Regards,

    Giotto

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    Please try this:

    AllSelected =
    IF (
        CALCULATE ( DISTINCTCOUNT ( Sales[Store] ), ALLSELECTED ( Sales[Store] ) )
            < CALCULATE ( DISTINCTCOUNT ( Sales[Store] ), ALL ( Sales[Store] ) ),
        SUM ( Sales[Quantity] ),
        CALCULATE ( SUM ( Sales[Quantity] ), ALL ( Sales[Store] ) )
    )

    Hope this helps.

     

    Best Regards,

    Giotto