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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
shashank
Helper III
Helper III

Comparing sales of month from previous year to month of current year

Hi Team,

 

I'm new to POWER BI , i was trying to create sales analysis report where we are supposed to do comparison of sales of previous year month and this year month. in this community i found some solutions  like using                                                                  "CALCULATE(SUM([Discount]), PARALLELPERIOD(DateTime[Order Date],-1,year))" but later on i found this syntax does not work with M, power bi query leanguage. 

 

1- wanted to know solution for that.

2- if that syntx does not work with M then what was the reason that such solution was shared in this community.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @shashank

In  your sceanrio, please follow the steps in the screenshots of my first reply to create a measure using your formula, then you are able to drag this measure to visuals and check its value.

Besides, you can take a look at the following resources to learn more about using different languages (DAX, "M", SQL, MDX and R) in Power BI.

Learning resources
The Languages of Power BI
Introduction to Power Query (informally known as "M") Formula Language
Deep Dive into Power Query Formula Language

Thanks,
Lydia Zhang

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @shashank,

Where do you apply the above formula in Power BI Desktop? We need to create a measure using the above formula rather than writing it using M language, you can check the example in the following screenshot, for more details about measures in Power BI Desktop, please review this article: Tutorial: Create your own measures in Power BI Desktop.

1.PNG2.PNG




Thanks,
Lydia Zhang

Hi Lydia,

 

Thanks for your suggestion, i was trying to use that method in creating "custom column"  functionality avaialable in power query window.

 

from this discussion what i learned that M leanguage is supposed to be used with power query and DAX for creaing new dimentions. Can you advise me some good playlist of learning advance power BI.

Anonymous
Not applicable

Hi @shashank

In  your sceanrio, please follow the steps in the screenshots of my first reply to create a measure using your formula, then you are able to drag this measure to visuals and check its value.

Besides, you can take a look at the following resources to learn more about using different languages (DAX, "M", SQL, MDX and R) in Power BI.

Learning resources
The Languages of Power BI
Introduction to Power Query (informally known as "M") Formula Language
Deep Dive into Power Query Formula Language

Thanks,
Lydia Zhang

Hi where are the scressnshots. I am unable to see. Aldo can you post another URL beacuse that video which yu posted is not available. Thanks

Hi Lydia,

 

thanks a lot for all of your help , it would be really helpfull if you can share some url where demo of advance visualations is taught.

Anonymous
Not applicable

Hi @shashank,

You may be interested in this video.

Thanks,
Lydia Zhang

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors