Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Arjun_reddy
Helper I
Helper I

dax query

Hi Community team,

 

need you help on one of the dax query, please find the below snap and understand my rrequirement, write a dax query on that,

I have year, period, sales fields, want to find out the growthrate on max year available period sales, the same periods in previous year sales to growth rate

the max year(2022) having 6 periods and the same periods should check in previous year periods if periods are avaiable in previous year should computing the sales.

Arjun_reddy_0-1692754796017.png

 

Thanks,

Arjun Reddy




1 ACCEPTED SOLUTION

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Arjun_reddy
Helper I
Helper I

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 

 

categoryyearPeriodsales
chairs2021p015000
tables2021p036000
bulbs2022p016000
sofa2022p044500
chairs2022p028000
chairs2021p066000
chairs2021p072800
sofa2022p054700
bulbs2022p042000
sofa2021p135500
tables2021p126000
tables2022p063400
bulbs2021p114000
    

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

 

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sunchips MP Dash 08_21.pbix

 

download the pbix file, use the page1 view and use the growthrate_occ measure, If py variable working fine, issue will resolve

Takes me to a sign-in page.  Ensure that in the file there is a Calendar Table with the Period column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I 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 also
 
VAR 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
Ashish_Mathur
Super User
Super User

Hi,

There are 5 periods in the max year (not 6).  Also, since P3 is not avaiable in the max year, why should that be considered for the previous year?  Please revise your question and clearly show how you got 19% as the result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.