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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
admin_xlsior
Post Prodigy
Post Prodigy

Help on DAX

Hi guys,

 

Need some help on my visualisation. I have this data which is an Item List, with its invoice date then a "age" time between that invoice data and my input date (lets call it As Of Date) :

ITEMINVOICEDATEAs of dateInvoice age
P-1000821/25/2016 0:001/4/2016 0:0021
P-1000831/25/2016 0:001/4/2016 0:0021
P-1000881/25/2016 0:001/4/2016 0:0021
P-1002492/8/2016 0:001/4/2016 0:0035
P-1002633/17/2016 0:001/4/2016 0:0073
P-1002643/17/2016 0:001/4/2016 0:0073
P-1002653/17/2016 0:001/4/2016 0:0073
P-1002663/17/2016 0:001/4/2016 0:0073
P-1002673/17/2016 0:001/4/2016 0:0073
P-1003593/14/2016 0:001/4/2016 0:00140
P-1003603/14/2016 0:001/4/2016 0:00140

 

I also have a Range Table like this :

NameFromTo
<=30 days030
31-90 days3190
> 90 days919999

 

Then for the clasification of the age, I create a measure like below :

Aging interval = CALCULATE(
                  VALUES('Range[Name]),
                  FILTER(
                     'Range',
                     'Items'[Invoice age] >= 'Range [FROM] &&
                     'Items'[Invoice age] < 'Range'[TO]
                                    )
)

 

If I create Table Visualization, it looks correct :

ITEMINVOICEDATEAs of dateInvoice ageAging interval
P-1000821/25/2016 0:001/4/2016 0:0021<= 30 days
P-1000831/25/2016 0:001/4/2016 0:0021<= 30 days
P-1000881/25/2016 0:001/4/2016 0:0021<= 30 days
P-1002492/8/2016 0:001/4/2016 0:003531 - 90 days
P-1002633/17/2016 0:001/4/2016 0:007331 - 90 days
P-1002643/17/2016 0:001/4/2016 0:007331 - 90 days
P-1002653/17/2016 0:001/4/2016 0:007331 - 90 days
P-1002663/17/2016 0:001/4/2016 0:007331 - 90 days
P-1002673/17/2016 0:001/4/2016 0:007331 - 90 days
P-1003593/14/2016 0:001/4/2016 0:0014091 - 150 days
P-1003603/14/2016 0:001/4/2016 0:0014091 - 150 days

 

Question is why I cannot put the Aging interval Measure to COLUMNS by using Matrix Visualization ?

 

I want to create something like this :

ITEM<= 30 days31 - 90 days91 - 150 days
P-1000821  
P-1000831  
P-1000881  
P-100249 1 
P-100263 1 
P-100264 1 
P-100265 1 
P-100266 1 
P-100267 1 
P-100359  1
P-100360  1

 

Can someone help or advice what should I do ?

 

Thanks,

 

 

1 ACCEPTED SOLUTION

Hi,

The AND() function takes 2 inputs.  Only when both inputs evaluate to TRUE will the AND() function also evaluate to TRUE. So if the Age of the invoice is >= min value and also <= max value, then it means that the Age of invoice falls between the min and ma values.  The AND() function will therefore evaluate to TRUE.  To convert TRUE to 1, one can multiply with 1.

Hope this clarifies.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

It works!!

I saw the measure, honestly I don't realy understand how it works ?

Measure = 1*(AND([Age of invoice]<=MAX('Ageing buckets'[To]),[Age of invoice]>=MIN('Ageing buckets'[From])))

 

Can you be so kind to explain a bit what's the logic in there? Sorry, but I'm really a beginner in DAX. I did some DAX material, but that one, is fantastic yet not easy for me to know what's going on.

Man Embarassed

 

Thanks,

 

Hi,

The AND() function takes 2 inputs.  Only when both inputs evaluate to TRUE will the AND() function also evaluate to TRUE. So if the Age of the invoice is >= min value and also <= max value, then it means that the Age of invoice falls between the min and ma values.  The AND() function will therefore evaluate to TRUE.  To convert TRUE to 1, one can multiply with 1.

Hope this clarifies.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi!

You can simplified this by creating a calculated column in your "items" table.

Create the calculated column with the next dax formula in your "items" table: 

INTERVAL = IF(ITEMS[Invoice age]>=0,IF(ITEMS[Invoice age]<=30,"<= 30 days",IF(ITEMS[Invoice age]<=90,"31 - 90 days","> 90 days")))
With this you can create the matrix you want:
 
interval.PNG
 

Hi, 

Sorry, I forgot to tell, I also need the range to be from a table. And what I know is I need to use CALCULATE to do that, however there is another stopper, I cannot use CALCULATE since I'm using Direct Query.

 

So that is the background story why I create a measure. (CALCULATE is not allowed for CalculatedColumn)

 

Thanks,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.