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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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

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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Hi @shashank,

You may be interested in this video.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.