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

Dax help

H Power Users,

 

I need help with a DAX calculation. I have 2 table and have relationship. I have Type column in table 1 and Amount column in Table 2. 

 

Below is the example data.

 

Input
TypeAmount
A100
B200
C300
D400
Total1000

 

 

Output 
TypeAmountTotal
A1001000
B2001000
C3001000
\D4001000
Total10001000

Total is the measure of Sum(Amount)

 

Thanks

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Kumarcy  - So maybe:

 

Total Column = SUMX(ALL('Table2'),[Amount])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@Kumarcy  - So maybe:

 

Total Column = SUMX(ALL('Table2'),[Amount])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you. It worked really well. I would like calculate % Total based on the measure created. 

 

%Total= Amount/ Total

 

Out put: 

 

Output   
TypeAmountTotal% Total
A100100010%
B200100020%
C300100030%
\D400100040%
Total10001000

100 %

 

Thanks,

 

@Kumarcy - That should just be:

Total % = [Amount] / [Total]

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks for reply. I have a blank value in type and has amount to that. I would like to include the amount in total measure but should not show in the visual and i have a visual filter like id not equal to 1.  How can i acheive this?

camargos88
Community Champion
Community Champion

Hi @Kumarcy ,

 

Try this measure:

 
Measure = CALCULATE(SUM('Table'[Amount]), ALL('Table'[Type]))


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

Proud to be a Super User!



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.