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

how to get the Proportioned sum using DAX

Hi All, 

I need help to get the Proportioned sum of the values using DAX

 

Here is data

CategoryValueProportion
A5030%
B440%
715%
D615%
E200 

 

Now I need a new column with the values multiplied by the Proportion of given value of E category value and the existing value in Simple  A= 50+ 30%(200), B= 4+40%(200), c=7+15%(200) etc.

How can i write the Dax formula for this?

 

Please Help. 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous Please remove .[Date] from [Week Ending].[Date] and see if values are coming as expected

 

Proportned Hours = var E_Category = CALCULATE(sum('Doller values'[Hours]),FILTER(ALLEXCEPT('Doller values','Doller values'[Week Ending]),'Doller values'[Merge Programme]="I&A Department")) RETURN Sumx('Doller values',('Doller values'[Financials.I&A Reallocation Rates]*E_Category)+'Doller values'[Hours])

View solution in original post

Anonymous
Not applicable

@Anonymous 
In case you want ot get program wise running total

Measure 2 = CALCULATE([Hours Proposed],FILTER(ALLEXCEPT(Test,Test[Program Name]),Test[WeekEnding]<=MAX(Test[WeekEnding])))

 use below measure 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous  Please use below code. In case you want measure use first one and in case you want calculated column use below one

Measure = 
VAR E_category = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category]="E"))
RETURN SUMX('Table',('Table'[Proportion]*E_category)+'Table'[Value])

Column = 
VAR E_category = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category]="E"))
RETURN ('Table'[Proportion]*E_category)+'Table'[Value]

 

Anonymous
Not applicable

Hi Vimal,

Thanks for the Formula. The Formula is Working Fine with the Measure, Returning Expected results But when I use the Filter, It is not returning data with the filter Used, For example, see the data

WeekCategoryValueProportion
Wk1A5030%
Wk1B440%
Wk1715%
Wk1D615%
Wk1E200 
Wk2A2230%
Wk2B3240%
Wk25215%
Wk2D615%
Wk2E500 

 

I need thew Proportioned number for Each week, But it is taking on the total sum. Please explain.

 

Thanks

 

Anonymous
Not applicable

Hi @Anonymous you mean E category value should be calculated every week. Use this measure

Measure = 
VAR E_category = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table',Data[Week]),'Table'[Category]="E"))
RETURN SUMX('Table',('Table'[Proportion]*E_category)+'Table'[Value])

 

Anonymous
Not applicable

Thanks Vimal, Appreciate your Help.

 

I am able to write the formula correctly , but the values I am getting is way higher than what was expected. I am asuming may be because of the extra columns in the data set which is duplicating the values. Any thoughts

Anonymous
Not applicable

Hi Vimal , Here is the formula I am writing

 

Proportned Hours = var E_Category = CALCULATE(sum('Doller values'[Hours]),FILTER(ALLEXCEPT('Doller values','Doller values'[Week Ending].[Date]),'Doller values'[Merge Programme]="I&A Department")) RETURN Sumx('Doller values',('Doller values'[Financials.I&A Reallocation Rates]*E_Category)+'Doller values'[Hours])
 

Here are the values I am getting

 

 
 

Capture.JPG

Anonymous
Not applicable

@Anonymous Please remove .[Date] from [Week Ending].[Date] and see if values are coming as expected

 

Proportned Hours = var E_Category = CALCULATE(sum('Doller values'[Hours]),FILTER(ALLEXCEPT('Doller values','Doller values'[Week Ending]),'Doller values'[Merge Programme]="I&A Department")) RETURN Sumx('Doller values',('Doller values'[Financials.I&A Reallocation Rates]*E_Category)+'Doller values'[Hours])

Anonymous
Not applicable

HI @Anonymous ,

 

I am able to get the Correct No.of Hours Based on your Formula, But when I add the Running Total for the Calculated Column , I am Getting Wrong Result . See the Image below.Running Total.JPG

Here is the Formula I used to calculate Running Total

Hours Proposed running total in Week ending =
CALCULATE(
    [Hours Proposed],
    FILTER(
        ALLSELECTED('Final Template'[Week ending]),
        ISONORAFTER('Final Template'[Week ending], MAX('Final Template'[Week ending]), DESC)
    )
)
 
 
Please Help!
 
Thanks
Anonymous
Not applicable

@Anonymous 
In case you want ot get program wise running total

Measure 2 = CALCULATE([Hours Proposed],FILTER(ALLEXCEPT(Test,Test[Program Name]),Test[WeekEnding]<=MAX(Test[WeekEnding])))

 use below measure 

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.

Top Solution Authors