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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
bcbuckley13
Helper III
Helper III

How to Create an Overdue status if course not taken within 30 days?

Hi, I've tried several different ways and am struggling.

Scenario: Users take a class that's assigned to them and they have 30 days to complete it, otherwise they are "Overdue" or if they complete it AFTER the Due Date, it is NO.

If they complete it within 30 days, then Yes.

What's causing my issues are the "null" cells for people that haven't completed the course.

 

How could I write this out?

 

bcbuckley13_0-1593555461585.png

 

1 ACCEPTED SOLUTION

Hi , @bcbuckley13 

You also can try to create custom columns in query editor.

M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc/RCcAgDATQXfItqKcm7Szi/mvU0opni3/heFySWqV4nB4BQZyoxzFmaa72IMYRGM09xzO/SkkpKVsUSIFUYZUmStPoUpSpKFNRXpSRsu9fm1uwLKK3dHMLfvmtx9/tAg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Reg Date" = _t, #"Due Date" = _t, #"Course Complete Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Reg Date", type date}, {"Due Date", type date}, {"Course Complete Date", type date}}),
    Custom1 = Table.AddColumn(#"Changed Type","New",each if [Course Complete Date]=null then Date.From( DateTime.LocalNow()) else [Course Complete Date]),
    Custom2 = Table.AddColumn(Custom1,"Re",each if [Course Complete Date]=null and [New]<=[Due Date] then null else if [Course Complete Date]=null and [New]>[Due Date] then "No" else if [Course Complete Date]<>null and [New]<=[Due Date] then "Yes" else if [Course Complete Date]<>null and [New]>[Due Date] then "No" else null
)
in
    Custom2

 

The result will show as below:

27.png

 

pbix attached

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi , @bcbuckley13 

Try to create a custom column in query editor:

Something like :

= Table.AddColumn(#"Changed Type", "Custom", each if [Course Complete Date] = null then null else if [Course Complete Date] <= [Due Date] then "Yes" else "No")

 Or  create a conditional column:

80.png

 

sample file attached

 

Best Regards,
Community Support Team _ Eason

 

 

 

I think her/his request would be more like this

Conditional Column.PNG

Regards

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Thanks everyone. Those solutions however don't address if the Completed date column is empty, and the Due date is < than Today's date, then "Overdue".

Hi , @bcbuckley13 

You also can try to create custom columns in query editor.

M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc/RCcAgDATQXfItqKcm7Szi/mvU0opni3/heFySWqV4nB4BQZyoxzFmaa72IMYRGM09xzO/SkkpKVsUSIFUYZUmStPoUpSpKFNRXpSRsu9fm1uwLKK3dHMLfvmtx9/tAg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Reg Date" = _t, #"Due Date" = _t, #"Course Complete Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Reg Date", type date}, {"Due Date", type date}, {"Course Complete Date", type date}}),
    Custom1 = Table.AddColumn(#"Changed Type","New",each if [Course Complete Date]=null then Date.From( DateTime.LocalNow()) else [Course Complete Date]),
    Custom2 = Table.AddColumn(Custom1,"Re",each if [Course Complete Date]=null and [New]<=[Due Date] then null else if [Course Complete Date]=null and [New]>[Due Date] then "No" else if [Course Complete Date]<>null and [New]<=[Due Date] then "Yes" else if [Course Complete Date]<>null and [New]>[Due Date] then "No" else null
)
in
    Custom2

 

The result will show as below:

27.png

 

pbix attached

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @bcbuckley13 

 

Please use this DAX formula in your desktop instead of using M code in Power query.

Yes No.PNG

Completed in 30 Days =
IF (
ISBLANK ( SELECTEDVALUE ( 'Table'[Course Complete Date] ) )
&& SELECTEDVALUE ( 'Table'[Due Date].[Date] ) < TODAY (),
"No",
"Yes"
)
 
Regards

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

aj1973
Community Champion
Community Champion

Hi @bcbuckley13 

Add a conditionla calculated Column to your Tabel, either in Power BI desktop using DAX or in Power query editor like in the image you are showing.

The added column will be 'Completed in 30 days' and the condition will be applied on the column 'Course completed day'

If the Cell is Null then "No" else "Yes"

 

Regards 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.