Hallo everyone!
I am fighting for a couple of hours with a DAX-calculation that originally sounded to be quite easy and I would be very happy about any help.
To quickly explain my "situation":
I do have a simple fact table with sales data. What I really want is quite easy to summarize: I want to create a measure that allows me to calculate the number of months that a certain customer "needed" to reach the treshhold of 1 Million Euros. That value is supposed to be shown on a customer dashboard that compares the top-customers. To start it would sufficient to hard-code the treshhold, later it should be replaced by a disconnected slicer.
My fact table is quite simple: Order Date, Amount and a calculated column called customer loyalty months that shows me for each sales transaction the number of months that this customer has been buying here. Furthermore I have a lookup-table for Customer Loyalty Months that is related to the loyalty month column of my fact-table.
My idea now was to create another calculated column in the fact table that creates some sort of running sum per customer based on the number of months:
Cumulated Revenue=Sumx(
Filter('Facts';Fact[Customer Loyalty Months] <= Earlier(Fact[Customer Loyalty Months]) && Fact[Customer ID]=Earlier(Fact[Kunde ID ]));
[Revenue])
This seems to work so far.
Now I try to create my measure that should show me the first month number where my treshhold (e.g. 1 million euros) has been reached. I tried a couple of things in DAX without success. I thought it would make to search for the lowest (min) month number where the treshhold has been reached:
[First Month Over Treshhold]=Calculate(
MINX(VALUES('Customer Loyalty Months');
'Customer Loyalty Months')[Month No]);
Filter(values('Customer Loyalty Months')[Month No]);
MAX(Fact[Cumulated Revenue])>1000000))
This however does not work - it always returns 1. It seems that my filter (MAX(Fact[Revenue]...) is not considered in the first MINX.
I could also imagine that I am misunderstanding the combination of X-Functions and Filter.
Regards,
julianwi
I am fighting for a couple of hours with a DAX-calculation that originally sounded to be quite easy and I would be very happy about any help.
To quickly explain my "situation":
I do have a simple fact table with sales data. What I really want is quite easy to summarize: I want to create a measure that allows me to calculate the number of months that a certain customer "needed" to reach the treshhold of 1 Million Euros. That value is supposed to be shown on a customer dashboard that compares the top-customers. To start it would sufficient to hard-code the treshhold, later it should be replaced by a disconnected slicer.
My fact table is quite simple: Order Date, Amount and a calculated column called customer loyalty months that shows me for each sales transaction the number of months that this customer has been buying here. Furthermore I have a lookup-table for Customer Loyalty Months that is related to the loyalty month column of my fact-table.
My idea now was to create another calculated column in the fact table that creates some sort of running sum per customer based on the number of months:
Cumulated Revenue=Sumx(
Filter('Facts';Fact[Customer Loyalty Months] <= Earlier(Fact[Customer Loyalty Months]) && Fact[Customer ID]=Earlier(Fact[Kunde ID ]));
[Revenue])
This seems to work so far.
Now I try to create my measure that should show me the first month number where my treshhold (e.g. 1 million euros) has been reached. I tried a couple of things in DAX without success. I thought it would make to search for the lowest (min) month number where the treshhold has been reached:
[First Month Over Treshhold]=Calculate(
MINX(VALUES('Customer Loyalty Months');
'Customer Loyalty Months')[Month No]);
Filter(values('Customer Loyalty Months')[Month No]);
MAX(Fact[Cumulated Revenue])>1000000))
This however does not work - it always returns 1. It seems that my filter (MAX(Fact[Revenue]...) is not considered in the first MINX.
I could also imagine that I am misunderstanding the combination of X-Functions and Filter.
Regards,
julianwi