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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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, @Anonymous 

 

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, @Anonymous 

 

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.

Anonymous
Not applicable

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

@Anonymous ,

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]

Anonymous
Not applicable

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 

@Anonymous , 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 ))

Anonymous
Not applicable

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.