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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

HEEELP with DAX Commands

Please Help.

I started using power BI recently and I need help.

i Need to get the ammount of days Left Before our service Expires to put it on a Table. (in Days)

I hace the dates when the client Purchases the service and the Expiration Date of the service, but i need to get the amount of days left before it expires.

 

Please Help

Thks

1 ACCEPTED SOLUTION
AUaero
Responsive Resident
Responsive Resident

Assuming your table looks something like this:

AUaero_0-1659049021533.png

Then this measure should work.  If you want to show the days since expiration, just get rid of the switch statement.

 

# Days Until Expiration = 
VAR TodayDate = UTCTODAY() - 6/24 // 6 indicates the number of hours from UTC (Central Time)
VAR ExpDate = MAX(ExpirationDates[ExpirationDate])

RETURN
SWITCH(
    TRUE(),
    DATEDIFF(TodayDate, ExpDate, DAY) < 0, 0,
    DATEDIFF(TodayDate, ExpDate, DAY)
)

 

Please accept this a solution if this solves your problem.

 

View solution in original post

2 REPLIES 2
AUaero
Responsive Resident
Responsive Resident

Assuming your table looks something like this:

AUaero_0-1659049021533.png

Then this measure should work.  If you want to show the days since expiration, just get rid of the switch statement.

 

# Days Until Expiration = 
VAR TodayDate = UTCTODAY() - 6/24 // 6 indicates the number of hours from UTC (Central Time)
VAR ExpDate = MAX(ExpirationDates[ExpirationDate])

RETURN
SWITCH(
    TRUE(),
    DATEDIFF(TodayDate, ExpDate, DAY) < 0, 0,
    DATEDIFF(TodayDate, ExpDate, DAY)
)

 

Please accept this a solution if this solves your problem.

 

Anonymous
Not applicable

Thank you so much!

You did it.

eres lo maximo bro!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.