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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

latest Month to last Month data comparison

Hello,

 

i have one scenario where "Info Table" have value for Jan, Feb, March, but we currently are in Oct. 

How can i show a separate column for diff of March and Feb?

and automatically if i get data for April, it will update to be the diff of April - March?

 

RW0711_1-1666174494163.png

 

i have a "calendar table" connecet with this " Info Table" by dates.

Please let me know if you want me to clarify more. thanks in advance!

 

Br,

RW

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please create three new columns:

 

Jan = IF('Fact Table'[Month] = 1, 'Fact Table'[Value])

Feb = IF('Fact Table'[Month] = 2, 'Fact Table'[Value])

Mar = IF('Fact Table'[Month] = 3, 'Fact Table'[Value])

 

vyadongfmsft_0-1666316556922.png

 

Create a table visual:

vyadongfmsft_1-1666316585756.png

You can rename field for table visual like below:

vyadongfmsft_2-1666316668989.png

Best regards,

Yadong Fang

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

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


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

Hello Yadong Fang!

Thanks for your exmaple, my final goal is to show the diff of latest month in visualization report , like what i present in excel.

RW0711_2-1666258697952.png

 

Do you know how to create a separate value for "Diff", regardless the column filter (in this case, "Month") ? Thanks again!

RW0711_1-1666258644640.png

RW0711_3-1666258740641.png

 

 

 

 

Hi @Anonymous ,

 

Please create three new columns:

 

Jan = IF('Fact Table'[Month] = 1, 'Fact Table'[Value])

Feb = IF('Fact Table'[Month] = 2, 'Fact Table'[Value])

Mar = IF('Fact Table'[Month] = 3, 'Fact Table'[Value])

 

vyadongfmsft_0-1666316556922.png

 

Create a table visual:

vyadongfmsft_1-1666316585756.png

You can rename field for table visual like below:

vyadongfmsft_2-1666316668989.png

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

You'd better transform data like below in Power Query firstly:

vyadongfmsft_0-1666243992581.png

 

You will get a table like this:

vyadongfmsft_1-1666244049902.png

 

Relationship between Calendar table and Fact table:

vyadongfmsft_2-1666244296666.png

 

 

Try following DAX to create two columns:

Previous Month = IF('Fact Table'[Month] = MAX('Calendar Table'[Month]),CALCULATE(MAX('Fact Table'[Value]),FILTER('Fact Table','Fact Table'[Month] = MAX('Calendar Table'[Month])-1 && 'Fact Table'[ID] = EARLIER('Fact Table'[ID]))))

Diff = IF('Fact Table'[Month] = MAX('Calendar Table'[Month]), 'Fact Table'[Previous Month] - 'Fact Table'[Value])

 

You will get the result you wnat:

vyadongfmsft_3-1666244348552.png

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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