Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello everyone,
I have a card visualization that I need to use to display that last two months of data. Our scenario is that our data feeds into our mart are staggered by 14 days from the present. So there are periods of time where we do not have complete data for the current month but also the previous month as well as the current month. Example would be if today was October 12, we would not have a complete October obviously, but nor a September. So my user wants to have this card display a total volume of medical patients received for the last two COMPLETE months no matter what the day. So effectively I want to be able to calculate the total for July and August as of today. Then then when we hit November, August and September. Then when we hit December, September and October, etc etc. Any suggestions?
Solved! Go to Solution.
Create a Date Dimension , Add 'IscurrentMonth' column.
if current month is October then
Oct will be = 0
Sep will be = -1
Aug will be = -2
July will be = -3
then filter your report or visual basic or Advance filter to value >=-3 AND <= -2
you can also restrict the values like this : value = -2 or value = -3
this is dynamically give you last 2 complted month data as per your scenerio.
IsCurrentMonth = IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY()),0,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-1,-1,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-2,-2,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-3,-3,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-4,-4,
BLANK() )))))
Hope this helps
SS
Create a Date Dimension , Add 'IscurrentMonth' column.
if current month is October then
Oct will be = 0
Sep will be = -1
Aug will be = -2
July will be = -3
then filter your report or visual basic or Advance filter to value >=-3 AND <= -2
you can also restrict the values like this : value = -2 or value = -3
this is dynamically give you last 2 complted month data as per your scenerio.
IsCurrentMonth = IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY()),0,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-1,-1,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-2,-2,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-3,-3,
IF(
YEAR('Date'[Date])=YEAR(TODAY()) && MONTH('Date'[Date]) = MONTH(TODAY())-4,-4,
BLANK() )))))
Hope this helps
SS
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |