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
Dunner2020
Post Prodigy
Post Prodigy

Detail information table shows some unwanted information

Hi there,

 

I have created a measure that calculates the occurrence (i.e. how many times) of a particular code occurs (i.e.) and returns the number if it is more than two. My measure looks like as follow:

 

test_unknown =
var _count = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))
Return
if(_count >2,_count)
 
I used that measure in a table and the result looks fine as shown in the picture:
 Screenshot 2021-01-11 152855.png
 
I created another table visual to show the detail of each row shown in the above table. The problem is that when I click on the any row of the above table, the detail shows on another table contains some information that should not be there. For example in the following picture:
Screenshot 2021-01-11 153313.png
 
When clicking on the first row of the left-hand table, the right-hand table displays the detail of 4 events. However, it also shows information related to code 5A (the last row of the right-hand table). In the formula of measure I mentioned that only count the rows with code = 0 but in the detailed information, it shows a row that has code with value 5A. Could anyone help me where I made the mistake?
1 ACCEPTED SOLUTION

@Dunner2020 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Try this in beween

 

test_unknown =
var _count = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))
Var _Tab = addcolumns(summarize('Table', 'Table'[Station],"_1" ,CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))), "_2", CALCULATE(Sumx('Table', _1), allexpect(Table, Table[Station])))
Return
sumx(filter(_tab, _2>2),_1)

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Dunner2020 , I think need to force row context of station

try measure like

 

test_unknown =
var _count = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))
Return
if(CALCULATE(_count, allexpect(Table, Table[Station])) >2,_count)

@amitchandak , I used the measure you mentioned in the reply but it did not change the result. Still getting 5A code in detail informaiton table.

@Dunner2020 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Try this in beween

 

test_unknown =
var _count = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))
Var _Tab = addcolumns(summarize('Table', 'Table'[Station],"_1" ,CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(RELATEDTABLE('Table2'),'Table2'[Code]="0"))), "_2", CALCULATE(Sumx('Table', _1), allexpect(Table, Table[Station])))
Return
sumx(filter(_tab, _2>2),_1)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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