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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
msa_007
Frequent Visitor

Measure Possible Context Issue

Hi there,

 

The following measure is causing my visual to "...exceed the available resources"

 

 

CF_ReviewStatusDays = 
var v_formatting =
    SWITCH(
        TRUE(),              
        isblank(max('Document Review (Workflow)'[Actual Completion Date])),0,
        max('Document Review (Workflow)'[Days (before/after) Scheduled Completion])>=1                      //1-4 days before scheduled completion date
            && max('Document Review (Workflow)'[Days (before/after) Scheduled Completion])<5, 1,
        max('Document Review (Workflow)'[Days (before/after) Scheduled Completion])>=5, 2,                  //5+ days before scheduled completion date
        max('Document Review (Workflow)'[Days (before/after) Scheduled Completion])<0, -1                   //Overdue
    )
    RETURN
    v_formatting

 

 

The measure is trying to provide some coding to support conditional formatting on my table.

 

If the completion date is blank then return 0

If the number of days until scheduled completion is between 1-4 then return 1

If the number of days until scheduled completion is greater than 5 then return 2

and if the number of days until scheduled completion is negative return -1

 

Is the problem associated with mixing my date table with numbers or a context problem?  Please help.

 

The model is as follow:

 

msa_007_0-1716879222443.png

 

Any help appreciated.  thanks.

 

2 REPLIES 2
msa_007
Frequent Visitor

Hi @amitchandak,

 

Thanks for your reply.

 

I think you didn't see the date component of the dax, and I think that was the main issue I was having.  Any ideas on that?  Many thanks for your help.

amitchandak
Super User
Super User

@msa_007 ,Try

 

CF_ReviewStatusDays =
var _max = max('Document Review (Workflow)'[Days (before/after) Scheduled Completion])
var v_formatting =
SWITCH(
TRUE(),
isblank(_max),0,
_max <0, -1 , //Overdue
_max <5, 1,
_max>=5, 2 //5+ days before scheduled completion date

)
RETURN
v_formatting

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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