Forum Discussion
dax query
- 3 years ago
Whenever you have the opportunity to, share the download link of the PBI file with a Calendar Table and a Period column in the Calendar Table.
don't take the table reference, just understanding purpose i have shared the snap,
for suppose which is i have selectedvalue as year, that year all the periods should sumup that is CY and the same periods sales should sumup in previous year that is PY, this CY,PY variables should use for growth rate
for suppose i have selected 2022 year, In this year only 5 periods, 5 periods sales should compute and the same periods should compute the sales for finding growth rate
Note: don;t consider the missed period, for assumption gave the snap
| category | year | Period | sales |
| chairs | 2021 | p01 | 5000 |
| tables | 2021 | p03 | 6000 |
| bulbs | 2022 | p01 | 6000 |
| sofa | 2022 | p04 | 4500 |
| chairs | 2022 | p02 | 8000 |
| chairs | 2021 | p06 | 6000 |
| chairs | 2021 | p07 | 2800 |
| sofa | 2022 | p05 | 4700 |
| bulbs | 2022 | p04 | 2000 |
| sofa | 2021 | p13 | 5500 |
| tables | 2021 | p12 | 6000 |
| tables | 2022 | p06 | 3400 |
| bulbs | 2021 | p11 | 4000 |
- Ashish_Mathur3 years agoSuper User
Hi,
So do you want to see the growth rate in a card visual. You will also need to share a Calendar Table with a column there of Period.
- Arjun_reddy3 years agoHelper I
don't have the option for sharing and for uploading the pbix file and data file
create a calendar manually from 01/01/2021 to till now- Arjun_reddy3 years agoHelper II have return the below dax query for the CY getting accurate value, PY variable have the issue only, It is fetching all the periods sum value, I don't want to get it all, which are the periods are available that periods should get in previous year alsoVAR selectedyear=SELECTEDVALUE(Sunchips_MP[YEAR])VAR MAXPERIOD=MAX(Sunchips_MP[PERIOD])VAR cy =SUMX(FILTER(Sunchips_MP, Sunchips_MP[YEAR] = SelectedYear&&Sunchips_MP[PERIOD]<=MAXPERIOD),Sunchips_MP[TOTAL OCCASIONS])VAR py =SUMX(FILTER(Sunchips_MP,Sunchips_MP[YEAR] = SelectedYear-1&&Sunchips_MP[PERIOD]<=MAXPERIOD),Sunchips_MP[TOTAL OCCASIONS])VAR maxyear_GROWTHRATE=(cy-py)/py