Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Display only the last period visualization

Hi,

I want to buid a visulation that will only display results from the last period. I have a data model that includes monthly data. I want to display the last period based on the year I select from the slicer. 

 

I built a measurement "LastPeriod = (max ('Table'[Period]))" to show the last period. But I have a challenge to filter my results based on this calculated LastPeriod. I tried to build it in a column instead, but the column will be calcultated based on all data in the table, instead of the filtered data only. 

 

Thank you. 

 

Andy

  • Hi Anonymous 

     

    What is in your Period column? Which type of visual do you want to use? Can you provide some sample data and more detailed expected output to help us understand it better?

     

    Assume your original data is like below and Period column has Month numbers. You can add a Date table into your model. In Date table, add a Year column. And create a relationship between Date table and Fact Data table on Date columns (one-to-many, Single).

     

    Then you can use a measure like below to calculate the total of Sales in Last Period of a selected Year. 

    LastPeriod Sales = CALCULATE(SUM(Sales[Sales]),FILTER(Sales,Sales[Period]=MAX(Sales[Period])))

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

1 Reply

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi Anonymous 

     

    What is in your Period column? Which type of visual do you want to use? Can you provide some sample data and more detailed expected output to help us understand it better?

     

    Assume your original data is like below and Period column has Month numbers. You can add a Date table into your model. In Date table, add a Year column. And create a relationship between Date table and Fact Data table on Date columns (one-to-many, Single).

     

    Then you can use a measure like below to calculate the total of Sales in Last Period of a selected Year. 

    LastPeriod Sales = CALCULATE(SUM(Sales[Sales]),FILTER(Sales,Sales[Period]=MAX(Sales[Period])))

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.