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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
esingh
Frequent Visitor

DAX Calculation: multiple tables

Hi Fabric Community,

 

I am new to Power BI and facing issues to create a dax calculation to achieve the following result:

From table 1 for insitution ABC, id 10, header string='A' we need to pick out responsecount=14012333 and divide it by values from the table 2 with following inputs institution ABC, Sum of values for Optionstring= 'Direct Costs' and 'Indirect Costs" and headerstring='aa' and 'bb'  which means= 46 dollars( 13+16+4+13) refered filtered table 2

I am looking for the values of  1401233/46.

 

Table1:

esingh_0-1727436791787.png

Table 2:

esingh_2-1727436903369.png

 

Filtered Table2:

esingh_1-1727436867703.png

 

Thanks

Ekam

 

5 REPLIES 5
ryan_mayu
Super User
Super User

pls paste the sample data here (not the screenshot). What about the rest ,e.g. DEF? also get the value from table 2 with only "aa" and "bb" in the Direct Costs' and 'Indirect Cost"?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan Mayu, You are right in your interpretation we need to get the data for DEF as well. I have just kept data of two institutes in table 2 for the purpose. Filter values remain unchanged, institute changes(dynamic). Sample data.

idoptionStringheaderStringresponseCountinstitution_nameinstitution_code
10xxA1401233ABC10
10xxA1401000DEF20
10yyA0GHI30
10yyA0JKL40
10xxB59ABC10
10xxB53DEF20
10yyB0GHI30
10yyB0JKL40

 

Table 2:
idoptionStringheaderStringresponseCountinstitution_nameinstitution_code
4Expendituresaa$15ABC10
4 Expendituresbb$18ABC10
4Expenditurescc$12ABC10
4Direct Costsaa$13ABC10
4Direct Costsbb$16ABC10
4Direct Costscc$11ABC10
4Indirect Costsaa$4ABC10
4Indirect Costsbb$13ABC10
4Indirect Costscc$2ABC10
4Assetsaa$10ABC10
4 Assetsbb$12ABC10
4Assetscc$8ABC10
4Labor Expense aa$20ABC10
4Labor Expense bb$64ABC10
4Labor Expense cc$13ABC10
4Expendituresaa$15DEF20
4 Expendituresbb$18DEF20
4Expenditurescc$12DEF20
4Direct Costsaa$13DEF20
4Direct Costsbb$16DEF20
4Direct Costscc$11DEF20
4Indirect Costsaa$4DEF20
4Indirect Costsbb$13DEF20
4Indirect Costscc$2DEF20
4Assetsaa$10DEF20
4 Assetsbb$12DEF20
4Assetscc$8DEF20
4Labor Expense aa$20DEF20
4Labor Expense bb$64DEF20
4Labor Expense cc$13DEF20

 

 

@esingh 

pls try this

 

Measure = DIVIDE(sum('Table'[responseCount]), SUMX(FILTER('Table (2)','Table (2)'[institution_name]=MAX('Table'[institution_name])&& 'Table (2)'[optionString] in {"Indirect Costs","Direct Costs"} && 'Table (2)'[headerString] in {"aa","bb"}),'Table (2)'[responseCount]))
 
11.PNG
 
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




BIswajit_Das
Super User
Super User

Hello @esingh 
As per your explanation & requirement you can try the below DAX but There might be a problem afterwards cause as you explained all the filter values are hardcoded in to the DAX.
It Means This DAX only work for mentioned filters It means the values are specified.
SS.png
Thanks & Regards...

Tanks Biswajit , But the data need to vary based on the insitute. filter remain fixed.

Ekam

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.