Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Team,
I'm facing some challenges for creating the Custom PreviousMonth DAX function based on below mentioned calendar for 2024, Dateadd & PreviousMonth functions are not getting accurate here. I will be appriciated your suggestions!!
Customised Sales Calendar - 2024 | |
Start Date | Close Date |
1/3/2024 | 1/31/2024 |
2/1/2024 | 2/29/2024 |
3/1/2024 | 4/1/2024 |
4/2/2024 | 4/30/2024 |
5/1/2024 | 5/31/2024 |
6/1/2024 | 7/1/2024 |
7/2/2024 | 7/31/2024 |
8/1/2024 | 9/3/2024 |
9/4/2024 | 9/30/2024 |
10/1/2024 | 10/31/2024 |
11/1/2024 | 12/2/2024 |
12/3/2024 | 1/2/2025 |
Hi @Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Previous start date =
VAR _selsdate =
SELECTEDVALUE ( 'Table'[Start Date] )
RETURN
CALCULATE (
MAX ( 'Table'[Start Date] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Start Date] < _selsdate )
)
Previous close date =
VAR _selcdate =
SELECTEDVALUE ( 'Table'[Close Date] )
RETURN
CALCULATE (
MAX ( 'Table'[Close Date] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Close Date] < _selcdate )
)
Best Regards
Thanks for your reply... it is not supported for my requirement. The blow given DAX code gives me the selected month SalesCount. But i have to find the previous month SalesCount based on attached calendar month dates. It will be great help on this for to find the previousmonth count.
Hi @Anonymous ,
Could you please provide some sample data in the tables 'CPO Vehicle' and 'CPO Vehicle Temp' (exclude sensitive data) with Text format and the expected result base on the provided sample data? It is better if can explain the calculation logic? It would be very helpful to find the solution. Thank you. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
27 | |
13 | |
13 | |
11 | |
6 |