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

Need help please.

I am struggling to write a Dax function that returns the outstanding balance after doing some filtration. In the dataset below, I want to get the outstanding balance after doing this filtration (current date-registration date-upfront_days_included >=30). Return all those outstanding balance after doing this ....today minus registration date minus upfront days included >=30). 

I basically need a dax function to do this for me. Find below a snapshot of the data. God bless you!!

 

 

questionnn.PNG

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@emmanuelkamara1 - 

 

I believe the DAX should be something like:

 

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "Selector",(TODAY() - [registration_date_utc]) * 1. - [upfront_days_included]
    )
RETURN
  SUMX(FILTER(__Table,[Selector] >= 30),[Outstanding_balance])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

This is not clear. Please follow this post to maximize the chances of answers:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

I want to calculate the potfolio at risk which is the outstanding balce for accounts that have been disabled for 30+ days divided by all the outstanding balnce of enabled and disabled accounts. When a user register an account, the user will get a minimum of 7 days to use the product before it switches to disbaled mode. However, the user will get more than 7 days to use the product if the upfront price is  grater than the minimum upfront price. To get an accurate Portfolio at risk, I will have to filter out new accounts because I will not know if they are bad or good customers that is why I needed to do some filteration. Before including an account in my PAR calculation, I need to make sure that the current date minus the registration date minus the upfront days is grater than or equal to 30.

Greg_Deckler
Super User
Super User

@emmanuelkamara1 - 

 

I believe the DAX should be something like:

 

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "Selector",(TODAY() - [registration_date_utc]) * 1. - [upfront_days_included]
    )
RETURN
  SUMX(FILTER(__Table,[Selector] >= 30),[Outstanding_balance])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler , @Anonymous I want to calculate the potfolio at risk which is the outstanding balance for accounts that have been disabled for 30+ days divided by all the outstanding balance of enabled and disabled accounts. When a user register an account, the user will get a minimum of 7 days to use the product before it switches to disabled mode. However, the user will get more than 7 days to use the product if the upfront price is grater than the minimum upfront price. To get an accurate Portfolio at risk, I will have to filter out new accounts because I will not know if they are bad or good customers that is why I needed to do some filtration. Before including an account in my PAR calculation, I need to make sure that the current date minus the registration date minus the upfront days is grater than or equal to 30.

 

questionnn.PNG

@emmanuelkamara1 - So was my DAX formula correct because:

"Before including an account in my PAR calculation, I need to make sure that the current date minus the registration date minus the upfront days is grater than or equal to 30."

 

Unless I'm mistaken, that's what the DAX was doing.

 

Perhaps we need to backup. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for your time @Greg_Deckler , see below the output that I got. 

m.PNG

Thanks @Greg_Deckler , Works....I had to change the data-type .

 

Great!

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@emmanuelkamara1 - One, I would try it as a Card visual. Two, what does See details say?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors