Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm just a new guys on DAX. I have a function of sales: P= ((S0+S3)/2+S1+S2)/3
S0: Last month of previous quarter.
S1: First month of this quarter.
S2: second month of this quarter.
S3: last month of this quarter.
DATA run over years to years. Can anyone can help me how to calculate that, pls @@
Solved! Go to Solution.
Hi @philongxpct,
First, you should create calculated columns month, quarter, the first month of this quarter, the second month of this quarter, the end month of this quarter.
MonthOfYear = MONTH(Table1[Date]) Quarter = ROUNDUP(MONTH([Date])/3, 0) Firstt = MONTH(STARTOFQUARTER(Table1[Date])) End = MONTH(ENDOFQUARTER(Table1[Date])) Second month = (CALCULATE(MAX(Table1[MonthOfYear]),ALLEXCEPT(Table1,Table1[Quarter])) +CALCULATE(MIN(Table1[MonthOfYear]),ALLEXCEPT(Table1,Table1[Quarter])))/2
Then create measures using the following formulas.
S1 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[Firstt])) S2 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[Second month])) S3 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[End])) S0 = CALCULATE(Table1[Last],PARALLELPERIOD(Table1[Date],-1,QUARTER))
If you have other issues, don't hesitate to let me know.
Best Regards,
Angelia
Hi @philongxpct,
First, you should create calculated columns month, quarter, the first month of this quarter, the second month of this quarter, the end month of this quarter.
MonthOfYear = MONTH(Table1[Date]) Quarter = ROUNDUP(MONTH([Date])/3, 0) Firstt = MONTH(STARTOFQUARTER(Table1[Date])) End = MONTH(ENDOFQUARTER(Table1[Date])) Second month = (CALCULATE(MAX(Table1[MonthOfYear]),ALLEXCEPT(Table1,Table1[Quarter])) +CALCULATE(MIN(Table1[MonthOfYear]),ALLEXCEPT(Table1,Table1[Quarter])))/2
Then create measures using the following formulas.
S1 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[Firstt])) S2 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[Second month])) S3 = CALCULATE(SUM(Table1[Sale]),FILTER(Table1,Table1[MonthOfYear]=Table1[End])) S0 = CALCULATE(Table1[Last],PARALLELPERIOD(Table1[Date],-1,QUARTER))
If you have other issues, don't hesitate to let me know.
Best Regards,
Angelia
Hi @philongxpct,
If you have resolved your issue, please mark the corresponding reply as answer, which will help more people. If you still have issue, please feel free to ask.
Best Regards,
Angelia
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 38 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 67 | |
| 34 | |
| 32 | |
| 29 |