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
Hadi2021
Helper II
Helper II

Divide all dates values on a a specific date value from a norther column

Hi all 

I have the followeing table: 

Hadi2021_0-1637046760346.png

I would like to divide all returned values  from the 4th column on only the sales from January 

How could I achieve that ? 

Thanks in advance

Regards 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Hadi2021 

 

If you try to solve it with calculated columns, it will be easy.

 

Sales_January =
CALCULATE (
    MAX ( 'Table'[Sales] ),
    FILTER (
        'Table',
        [Date].[MonthNo] = 1
            && [Date].[Year] = EARLIER ( 'Table'[Date].[Year] )
    )
)
%Returned/January = DIVIDE([Returned],[Sales_January])

 

vzhangti_0-1637306870371.png

 

Best Regards,

Community Support Team _Charlotte

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-zhangti
Community Support
Community Support

Hi, @Hadi2021 

 

If you try to solve it with calculated columns, it will be easy.

 

Sales_January =
CALCULATE (
    MAX ( 'Table'[Sales] ),
    FILTER (
        'Table',
        [Date].[MonthNo] = 1
            && [Date].[Year] = EARLIER ( 'Table'[Date].[Year] )
    )
)
%Returned/January = DIVIDE([Returned],[Sales_January])

 

vzhangti_0-1637306870371.png

 

Best Regards,

Community Support Team _Charlotte

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

Hadi2021
Helper II
Helper II

I need to divide all values on the red boxes on the value of the first month of the their year 

Hadi2021_1-1637052819022.png

When I apply divide (Returned, Sales January) it only divided the first month and don't divide the other months. 

In OTher words, sales January is a measure where it calculate the sales when month = "January" , now I want to fill down all the missing data . in the third column ('Slaes January') so I can divided on the 4th column to calculate the ratio 

amitchandak
Super User
Super User

@Hadi2021 ,

Either use an independent date slicer and select jan there
// Independent Date table - Date1 and Joined Table Date
measure =
var _max = maxx(allselected('Date1'),'Date1'[Date]) // Use Date(2021,01,31)
var _min = minx(allselected('Date1'),'Date1'[Date])
return
CALCULATE(SUM(Sales[Sales Amount]),filter(Date, Date[Date]>=_min && Date[Date] <=_max ))

 

or put date


measure =
var _max = Date(2021,01,31)
var _min = Date(2021,01,01)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(Date, Date[Date]>=_min && Date[Date] <=_max ))

 

You can also Table's Date in place Date[Date]

Thank you for the fast reply 

I think I misexplained my problem 

I want to divide all the months returned value on the sales resulted from first month of the year 

Hadi2021_0-1637048603324.png

The idea filling all the values in yellow so I can build monthly trend

Thanks again and looking forward for your help 

REgards 

@Hadi2021 , Use all in filter and try

 

measure =
var _max = Date(2021,01,31)
var _min = Date(2021,01,01)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(all(Date) , Date[Date]>=_min && Date[Date] <=_max ))

Unfortunately its not working 

Hadi2021_0-1637052589106.png

I need to return the value of sales for the first month of the year. this value should be a reference value to divide all  other values on it 

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.