Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |