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
preetjawaria
Frequent Visitor

Calculating same measure with different filter context

Sample Data:

 

Acct NameBill NameReport Count
A1Null7
A2Null12
NullB113
NullB29
NullB33

 

I have a scenario now - I created 2 slicer - Acct Name & Bill Name

I am presenting the SUM(Report Count) in two different Card Visuals-

1. where in one place the measure/Card visual affected by only Acct Name Slicer (configured By Edit Interactions)

2. In another place the measure/Card Visual gets affected by only Bill Name Slicer. (configured By Edit Interactions)

 

Requirement:

I want to have a calculation (Total Measure) which will return me the SUM of (Value appearing in point 1 , Value appearing in Point 2) , so whatever value I select from both the slicers accordingly the Total Measure should change.

 

At last I want to show the Total Measure in a Card Visual only.

1 ACCEPTED SOLUTION

Hey @preetjawaria ,

 

your requirement can not be solved having only a single table, this due to the concept of Auto-Exist: Understanding DAX Auto-Exist - SQLBI

My recommendation is to create a proper star schema with separate Dimension Tables Account and Bill, you might also consider creating two fact tables one for BILL and one for ACCOUNT.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

5 REPLIES 5
v-jianboli-msft
Community Support
Community Support

Hi @preetjawaria ,

 

Approve with @TomMartens , If you want to achieve this, you may need to create a new table.

Please try:

First create a new table for slicer:

vjianbolimsft_0-1670478278795.png

Then use the two columns to create two slicers

Apply the measures:

Measure For Acct Name = CALCULATE(SUM('Table'[Report Count]),FILTER('Table',[Acct Name]=SELECTEDVALUE('For slicer'[Acct Name])))

Measure For Bill Name = CALCULATE(SUM('Table'[Report Count]),FILTER('Table',[Bill Name]=SELECTEDVALUE('For slicer'[Bill Name])))

Total = [Measure For Acct Name]+[Measure For Bill Name]

Final output:

vjianbolimsft_1-1670478632568.png

Best Regards,

Jianbo Li

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

Thanks for the inputs. everyone.

preetjawaria
Frequent Visitor

Hi @TomMartens , you understood the scenario correctly, now lets say you select value A1 from first slicer and B2 from the other slicer - then the card visuals will show 7 and 9 respectively.

So the Total Measure should return 16 (7+9) to us.

Am I clear now ?

Hey @preetjawaria ,

 

your requirement can not be solved having only a single table, this due to the concept of Auto-Exist: Understanding DAX Auto-Exist - SQLBI

My recommendation is to create a proper star schema with separate Dimension Tables Account and Bill, you might also consider creating two fact tables one for BILL and one for ACCOUNT.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
TomMartens
Super User
Super User

Hey @preetjawaria ,

 

I'm not 100% clear about the expected result.
From my understanding there are currently two card viusals that are only affected by their corresponding slicers (configured by edit interaction).
My assumption is that these two slicers do not affect each other as well. Is this assumption correct.

What is the expected result for the Total Measure if nothing is selected from both card visuals, meaning both card visuals are showing the value 44 as in the in the screenshot below:
image.png
Can you please describe why you can't use a simple measure like the one below for calculating the measure Total Measure:

Total Measure = SUM( 'your table name'[report count] )

 

Regards,
Tom 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.