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
SupriyaVarun
Frequent Visitor

DAX Measure for not showing the future months

Hi Everyone,

 

Can you please help me with this, For the below query how to show blank  for

the future months?


Eg : August month showing  -44.6% Now I want it to show a blank Value

 

SupriyaVarun_0-1689772754325.png

 

 Measure Below : 

 

% Automated Order EU - Previous Month =
VAR CurrentAcual = [% Automated order EU]
VAR PreviousActual =
CALCULATE (
[% Automated order EU],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)
RETURN
CurrentAcual - COALESCE ( PreviousActual, CurrentAcual )

 

I want the output like this below:

SupriyaVarun_0-1689779682542.png

 

 

Thanks in advance

1 ACCEPTED SOLUTION

Hi,

 

Thanks for the response.

 I am using a Live connection

I just used this measure and its working now 

% Automated Order Global - Previous Month =
VAR CurrentActual = [% Automated order]
VAR PreviousActual =
CALCULATE (
[% Automated order],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)
VAR CurrentMonthNumber = MONTH(TODAY()) +1
VAR SelectedMonthNumber = SELECTEDVALUE('SM Dim Calendar'[Fiscal Month Number])

RETURN
IF (
SelectedMonthNumber >= CurrentMonthNumber,
BLANK(),
CurrentActual - COALESCE ( PreviousActual, CurrentActual )
)

I got the result 🙂

 

SupriyaVarun_0-1689784310111.png

 

 

 

View solution in original post

3 REPLIES 3
rubayatyasmin
Super User
Super User

Hi, @SupriyaVarun 

 

To ensure that future months show as blank, you can add a condition that checks whether the month is in the future, and if it is, returns BLANK(). You can use the TODAY() function to get the current date and use it for the comparison.

 

try this

 

% Automated Order EU - Previous Month =
VAR CurrentDate = TODAY()
VAR CurrentMonth = MONTH(CurrentDate)
VAR CurrentYear = YEAR(CurrentDate)
VAR CurrentFiscalMonthNumber =
LOOKUPVALUE(
'SM Dim Calendar'[Fiscal Month Number],
'SM Dim Calendar'[Calendar Year], CurrentYear,
'SM Dim Calendar'[Calendar Month], CurrentMonth)

VAR CurrentAcual = [% Automated order EU]
VAR PreviousActual =
CALCULATE (
[% Automated order EU],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)

RETURN
IF (
MAX('SM Dim Calendar'[Fiscal Month Number]) > CurrentFiscalMonthNumber,
BLANK(),
CurrentAcual - COALESCE ( PreviousActual, CurrentAcual )
)

 

note: Please note that you should adjust this based on your fiscal year start month if it does not start in January.

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hi,

 

Thanks for the response.

 I am using a Live connection

I just used this measure and its working now 

% Automated Order Global - Previous Month =
VAR CurrentActual = [% Automated order]
VAR PreviousActual =
CALCULATE (
[% Automated order],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)
VAR CurrentMonthNumber = MONTH(TODAY()) +1
VAR SelectedMonthNumber = SELECTEDVALUE('SM Dim Calendar'[Fiscal Month Number])

RETURN
IF (
SelectedMonthNumber >= CurrentMonthNumber,
BLANK(),
CurrentActual - COALESCE ( PreviousActual, CurrentActual )
)

I got the result 🙂

 

SupriyaVarun_0-1689784310111.png

 

 

 

how about SelectedMonthNumber > CurrentMonthNumber, instead of SelectedMonthNumber >= CurrentMonthNumber?

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


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.