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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
hans3400
Helper I
Helper I

Measure dont show in Card

Hi

 

I have made some measures that I'm going to use in a custom KPI card. They are as follows:

This month = CALCULATE(SUM('Table1'[downloads]), LASTDATE('Table1'[date]))
Previous month = 
CALCULATE(SUM('Table1'[downloads]), PREVIOUSMONTH('Table1'[date]))
Difference = [This month]-[Previous month]
 
When I test the messures in a table it all looks good. All the columns are filled with the correcet values. When I each of them in a Card, only [This month] are giving the correct calue. The other two are blanks. The only way I can get them to work, is if I put in a Slicer and select a surtainb month. 

I want it to show witout a filter and just show this month, the last month and the difference. 
 
Hope someone can help. 
 
3 REPLIES 3
amitchandak
Super User
Super User

@hans3400 , is there a date selected on the page? because if there is no date then the previous month's takes first data in date table

 

Try like 

 

This Month =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),0)
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 


Last Month =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max1,-1)
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

Why previousmonth does not give result when datesmtd is giving it: https://youtu.be/1KkoJehRVeg

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

I should say that my date column looks like this:

1. january 2022
1. feburary 2022
1. march 2022

and so on

I only get data each month

No date is selected. The goal is to get it to work on a clean report, so no filters or nothing. I thought that I would get the correct values from PREVIOUSMONTH, so it would give me the downloads from October (If the last date is 1. november 2022). I will try your suggestions. Thank u so much. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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