Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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?

Month data.PNG

 

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

 

1 ACCEPTED SOLUTION

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.

 

Annotation 2020-04-03 171954.png

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

 

View solution in original post

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

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

Annotation 2020-04-02 163811.png

 

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:

Annotation 2020-04-02 164104.png

 

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
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?

 

Last month sales.PNG

 

Thanks again.

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.

 

Annotation 2020-04-03 171954.png

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

 

In this case, other visuals will get change when we select the month in slicer. which will not server the purpose. 

Can you please let me know that should work in CARD visual and its should not impact on any other visuals.

amitchandak
Super User
Super User

@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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.