Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
I have a table say website, I want to form a DAX which can provide me the sum of the Ranking for the month July and June. August is the current month as of now. so i need the sum for last month(July) and previous of last month(June)
The DAX calculation should get the SUM of Ranking = 12 for July and SUM of Ranking = 4 for June
I tried using the below DAX query but it is throwing circular error . Can someone please suggest what modifications can i make to calculate the sum of Ranking for June month?
For July the DAX calculation works fine :-
last_month_click =
CALCULATE (
SUM ( 'Website'[Clicks] ),
MONTH ( 'Website'[date] )
= MONTH ( TODAY () ) - 1
)
For June the DAX throws circular dependency error for below formula:-
Previousof_last_month_click =
CALCULATE (
SUM ( 'Website'[Clicks] ),
MONTH ( 'Website'[date] )
= MONTH ( TODAY () ) - 2
)
My data source input is as below :-
| Ranking | Clicks | date |
| 1 | 2000 | 02.08.2021 |
| 2 | 1200 | 01.08.2021 |
| 1 | 2300 | 01.08.2021 |
| 3 | 1000 | 31.07.2021 |
| 4 | 900 | 29.07.2021 |
| -1 | 200 | 28.07.2021 |
| -2 | 100 | 27.07.2021 |
| 1 | 2400 | 26.07.2021 |
| 2 | 2100 | 25.07.2021 |
| 4 | 1300 | 24.07.2021 |
| 1 | 1800 | 21.07.2021 |
| 1 | 1400 | 29.06.2021 |
| 2 | 1100 | 27.06.2021 |
| 1 | 1300 | 25.06.2021 |
Please suggest.
Kind regards
Sameer
Solved! Go to Solution.
This_Month_Clicks = CALCULATE(sum('Website'[Clicks]),PARALLELPERIOD('Website'[Date],0,MONTH))
LastMonth_Clicks = CALCULATE(sum('Website'[Clicks]),PARALLELPERIOD('Website'[Date],-1,MONTH))
Warning: This takes into account the peculiar behavior of PARALLELPERIOD (and other functions) that will return the WHOLE period, not just a single day.
Hi @lbendlin I used the above DAX you suggested for LastMonth_Clicks but I still got the same error below :-
"A circular dependency was detected website(column),website [PMR],website[column]"
My Present month DAX is as below :-
PMR =
CALCULATE (
SUM ( 'Website'[Clicks] ),
MONTH ( 'Website'[date] )
= MONTH ( TODAY () )
)
Not sure why I am getting circular dependency and how can i fix it?
Could you please suggest where I am going incorrect with my DAX. Say if I want the Present month and previous month sum for the clicks.
Use the same parallel period approach, with a zero offset.
@lbendlin I actually havent got any exposure on parallel period function.It will be great if you can provide me some lines of DAX for this.
I will check if it is working for my scenario..
This_Month_Clicks = CALCULATE(sum('Website'[Clicks]),PARALLELPERIOD('Website'[Date],0,MONTH))
Thankyou it worked 🙂
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |