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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Multiplying a column by a filtered value on another column

Hey, 

 

I wonder if someone can help me out with this issue, I'll try to be as compact and clear as possible.

 

Imagine 2 tables: TbFactor and TbValue similar to what's described below. In my ERD they are connected through the YEAR column. I would like to find a way to, when I click a checkbox in my dashboard, multiply the VALUE column in TbValue by the corresponding factor in TbFactor - e.g: For the 1st row in TbValue, VALUE would be equal to 230 * 1.8. Please refer to the example tables below:

 

TbFactor

YEARFACTOR
20201.8
20211.5
20221.2
20231

 

TbValue

YEARCol2Col3VALUE
2020(...)(...)230
2020(...)(...)399
2021(...)(...)259

 

The closest I could arrive to was this:

 

C_01_idx_2 = IF(ISFILTERED(AUX[Column1]), MAX(TbValue[Value])*MAX(TbFactor[Factor]), MAX(TbValue[Value]))
 
 
I can't seem to make match without having to aggregate via MAX(), and this (expectedly) multiplies the column only by the highest factor, without taking year into account
 
I'm quite new to PowerBI so there might be something basic that I'm missing. Appreciate any tips.
 
Thanks!

 

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @Anonymous 

You can refer to the following measure

C_01_idx_2 = IF(ISFILTERED(AUX[Column1]),MAXX(FILTER(TbFactor,[YEAR]=SELECTEDVALUE(TbValue[Year])),[Factor])*SELECTEDVALUE(TbValue[VALUE]),SELECTEDVALUE(TbValue[VALUE]))

Output

vxinruzhumsft_0-1678326050453.png

 

vxinruzhumsft_1-1678326059559.png

Best Regards!

Yolo Zhu

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

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @Anonymous 

You can refer to the following measure

C_01_idx_2 = IF(ISFILTERED(AUX[Column1]),MAXX(FILTER(TbFactor,[YEAR]=SELECTEDVALUE(TbValue[Year])),[Factor])*SELECTEDVALUE(TbValue[VALUE]),SELECTEDVALUE(TbValue[VALUE]))

Output

vxinruzhumsft_0-1678326050453.png

 

vxinruzhumsft_1-1678326059559.png

Best Regards!

Yolo Zhu

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

 

Anonymous
Not applicable

This worked very well with my data. Thanks for the help!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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