Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Group Measures by Year

Hello Friends,

I have 3 measures Toys Sales, Clothes Sales and Shoe Sales by Location and Year as below in a cross tab.

I want to show the measures together by Year as below.

This is Power BI desktop.

Regards

NB

 

 

  • Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    Measures:

    Clothes Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Clothes Sales"
        )
    )
    Shoes Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Shoes Sales"
        )
    )
    Toys Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Toys Sales"
        )
    )

     

    Result:

     

    If i misunderstand your thoughts, please show us some sample data and expected result with OneDrive for business. Do mask sensitive data before uploading. Thanks.

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • MattAllington's avatar
    MattAllington
    Icon for Community Champion rankCommunity Champion

    You can do this is you write one measure "sales", and then use a column from your model for "category" and "year"

    • Anonymous's avatar
      Anonymous
      Not applicable

      All the data is one flat table.I can arrange that into Fact and Dimensions if I need to.

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    Measures:

    Clothes Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Clothes Sales"
        )
    )
    Shoes Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Shoes Sales"
        )
    )
    Toys Sales Measure = 
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            'Table',
            [Category]="Toys Sales"
        )
    )

     

    Result:

     

    If i misunderstand your thoughts, please show us some sample data and expected result with OneDrive for business. Do mask sensitive data before uploading. Thanks.

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.