The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm setting up a panel in PowerBI, where I have to identify activation! I have a Fat table with the customer / vendor columns / date sale / value: The same is already linked to a date table, I would like to calculate how many days runs between the last and last but one last sale by customers, in my case all dates are In a single column sale date. Could someone help me in the formula?
I would like to calculate how many days runs between the last and last but one last sale by customers, in my case all dates are In a single column sale date.
@MFelix, based on my understanding, ALLEXCEPT ( Table1, Table1[NameCliente] ) may be needed to calculate sales dates for each customer in this scenario.
@wagnerantunes84, could your try using the formula below to create a measure to see if it works?
Previous_Sales_Days = VAR lastPurchaseDate = CALCULATE ( MAX ( Table1[DataBase] ), ALLEXCEPT ( Table1, Table1[NameCliente] ) ) VAR penultimateDate = MAXX ( FILTER ( ALLEXCEPT ( Table1, Table1[NameCliente] ), Table1[DataBase] < Current_Date ), Sales_dates[DataBase] ) RETURN DATEDIFF ( Previous_Date, Current_Date, DAY )
Just replace Table1 with your real table name.
Regards
Hi my friend, this firt method dont work. but i am trying this new example ok,
I'll get back to you soon, thank you very much.
sory my english, i am from brazil!
Hi @wagnerantunes84,
Add this measure to your table:
Previous_Sales_Days = VAR Current_Date = MAX ( Sales_dates[DataBase] ) VAR Previous_Date = MAXX ( FILTER ( ALL ( Sales_dates ); Sales_dates[DataBase] < Current_Date ); Sales_dates[DataBase] ) RETURN DATEDIFF ( Previous_Date; Current_Date; DAY )
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsJoin the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
95 | |
84 | |
66 | |
61 |
User | Count |
---|---|
246 | |
124 | |
115 | |
79 | |
78 |