Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Previous Month in Card visual not working

Hi All,

 

I'm trying to show the previous month in a card visual for our dashboard.

I've created a DAX using:

Sales Revenue Last Month = CALCULATE( SUM( FACT_VENTUREMARGIN[SALES_CURRENTYEARREVENUENZD] ), DATEADD(DimDate[Date], -1, MONTH))

 

I have joined the date table (Dimdate) with the FACT_VENTUREMARGIN table. 

 

The formula is working how it's suppose to, however when I add Sales Revenue Last Month to the card visual it comes up with 214mil. How do I make it so it works out to be the previous month?

 

I was thinking that an IF Statement would work? i.e. Date.month = previous month text then "yes", "no". Then I can filter the visual on "yes" and would show the last month figures.

Here is the code I used for previous month text:

Previous Month Text = FORMAT(DATE("2020",MONTH(TODAY())-1,"01"),"mmmm")

 

Any help would be great!

 

Thanks all

 

  • Hi Anonymous ,

     

    If so ,you can click on the row in the table and see the card changed to the value in last month,or you can use a slicer to filter the data.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!

     

5 Replies

  • Anonymous 

    The formula seems fine. But that is date visual/card is taking. if there is no slicer or visual level filter it will end date of the calendar.

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

    Hi Anonymous ,

     

    I have tested with my sample data and it works fine here, as you see below:

     

    So would you pls check whether you have added a filter on the card visual,or you can check the interaction between the table visual and the card visual:

    Go to menu bar>format>edit interactions,when you select the table visual,you will see that the card visual is showing filtered on the right top conner:

     

    Thus,what the card visual shows should equal to the total number in a table visual.

    Here is my sample .pbix file you can refer to.
     
    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-kelly-msft Thanks for the reply. I can get the card to show the full amount. Though what I want to be able to is have the card update automatically for the last month sales. That's where I thought the conditional formatting would help?

       

       

      Thanks again.

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

        Hi Anonymous ,

         

        If so ,you can click on the row in the table and see the card changed to the value in last month,or you can use a slicer to filter the data.

         

        Best Regards,
        Kelly
        Did I answer your question? Mark my post as a solution!