Forum Discussion

lennox25's avatar
lennox25
Post Patron
3 years ago
Solved

Help with Unit Counting on Card and Counting between Unit Values - <100, 101-500, 501>

Hi,  Im hoping someone can help. Im having issues:  Using a card to show total no of R stores between 01/01/21 and 31/12/2021 with sales unit of greater than 0. This calculates the correct number ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi lennox25 ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want.

    1. Create two measures as below to get it:

    SUnits Sold = SUM('_Units'[Units sold])
    Count of Stores = 
    CALCULATE (
        COUNT ( 'Table_Store'[Store Licence ID] ),
        FILTER ( 'Table_Store', [SUnits Sold] > 0 )
    )

    2. Put the measure [Count of Stores] onto the card visual to replace the value field with aggregation function

     

    And if you want to get the count of stores for different unit sold range, you can follow the steps below to get it. Please find the details in Page 2 of the attachment.

    1. Create a range dimension table as below screenshot using Enter Data method

    2. Create a slicer using the range field in range dimension table

    2. Create a measure as below to get the count of store base on the slicer selection

    Measure = 
    IF (
        ISFILTERED ( 'Units Sold Range'[Range] ),
        CALCULATE (
            DISTINCTCOUNT ( 'Table_Store'[Store Licence ID] ),
            FILTER (
                'Table_Store',
                SWITCH (
                    SELECTEDVALUE ( 'Units Sold Range'[Range] ),
                    "0-100",
                        [SUnits Sold] > 0
                            && [SUnits Sold] <= 100,
                    "101-500",
                        [SUnits Sold] >= 101
                            && [SUnits Sold] <= 500,
                    "500+", [SUnits Sold] > 500
                )
            )
        ),
        COUNT ( 'Table_Store'[Store Licence ID] )
    )

    Best Regards