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
AviratG
Regular Visitor

Calculated column query problem

 

Example.PNGHi, I have the following data structure.

I need a calculated column which can be calculated by dividing the following cells marked in red i.e. 1-30(as of Dec 1,2016) and 31-60(as of Jan 1,2017) This calculation also needs to be done for all the rows in the two column.

Similarly, we have to calculate another column which has the division for 31-60(as of Dec 1,2016) and 61-90(as of Jan 1,2017) and so on similar to the previous column

This needs to be done for multiple Business Units which are not captured in the screenshot.

Would appreciate your inputs!

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @AviratG

 

This might get you gonig on the right path

 

New Col = 
VAR LastMonth1_30 = 
    MINX(
        filter(
            'Table',
            'Table'[Month] = EDATE(EARLIER('Table'[Month]),-1)
            ),
            'Table'[1-30])
VAR ThisMonth31_60 = 'Table'[31-60]
RETURN DIVIDE(ThisMonth31_60,LastMonth1_30)

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

My suggestion would be to unpivot the data and convert it into a 4 column one with columns for Business Unit, Month, ageing buckets and values.  Then we can directly write measures to get your desired result.


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

HI @AviratG

 

This might get you gonig on the right path

 

New Col = 
VAR LastMonth1_30 = 
    MINX(
        filter(
            'Table',
            'Table'[Month] = EDATE(EARLIER('Table'[Month]),-1)
            ),
            'Table'[1-30])
VAR ThisMonth31_60 = 'Table'[31-60]
RETURN DIVIDE(ThisMonth31_60,LastMonth1_30)

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.