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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
saivina2920
Post Prodigy
Post Prodigy

How do we get same balance counts details to display in chart table

I am developing reports and difficult to get banlance count record in table chart. pls. find attached sample test .pbix file

 

saivina2920_0-1628783458042.png

Now it's showing 4 rows. But, it should show only 2 rows..

 

https://1drv.ms/u/s!AiSRcgO5FUmN8UAoAERxZXjuQJNC?e=M1OjqY 

How do i get the correct balance record in the chart table.

Also, how do we get delay counts in the chart table.

For example, if EMP_Relieve_Date is past date from current date, then it should show the count duration

                      if EMP_Relieve_Date is futire date from current date, then it should not considered the count and the count duration is zero by default.

How do we achieve this...?

 

Output should be below format in the chart table.

 

EMP_NO EMP_RELIEVE_DATEDelay in Days
   
   
   

 

 

 

1 ACCEPTED SOLUTION

Hi @saivina2920 

 

Your original DurDays column didn't get the correct result because it referred to a wrong column EMP_TABLE[EMP_RELIEVE_DATE] in the DAX. After refering to the correct column as below, it returns the correct results. 

DurDays = IF(EMP_TABLE[EMP_RESIGN_DATE]>[vToday],BLANK(),DATEDIFF(EMP_TABLE[EMP_RESIGN_DATE],TODAY(),DAY))

 

My understanding is that C is to return the number of EMP_NOs which exist in A but don't exist in B. So your BalCount measure is able to be used as a filter field in the table visual. You can set up its value to 1 to determine which one only exists in A.

081701.jpg

 

If you don't want to use BalCount as a filter field, you can use below measure instead to filter the table visual. In this formula, __A/__B/__C are tables which return the distinct EMP_NOs in each group.

Measure C = 
VAR SELECTED = [vState]
VAR __A = CALCULATETABLE(DISTINCT('EMP_TABLE'[EMP_NO]),FILTER(ALL(EMP_TABLE), EMP_TABLE[EMP_STATE]=SELECTED
 && (CONTAINSSTRING(EMP_TABLE[TO],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
VAR __B = CALCULATETABLE(DISTINCT('EMP_TABLE'[EMP_NO]),FILTER(ALL(EMP_TABLE), EMP_TABLE[EMP_STATE]=SELECTED
 && (CONTAINSSTRING(EMP_TABLE[FROM],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
VAR __C = EXCEPT(__A,__B)
RETURN
IF(SELECTEDVALUE(EMP_TABLE[EMP_NO]) IN __C, 1, 0)

081702.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @saivina2920 

 

Sorry I don't understand your expected result. Assume we select Wales in the slicer, which two records should be the Balance([XTOY] - [YTOX]) to be shown in the table visual? 

081602.jpg

 

Regards,
Community Support Team _ Jing

Thanks for youe reply. I have highlighted with correct data and formula. 

 

pls. refer the sample attached XL data and Pbix file as mentioned below.

 

https://1drv.ms/u/s!AiSRcgO5FUmN8UiVPTOFR_R4KHIl?e=bvmNqp 

 

saivina2920_0-1629108837831.png

pls.let me know if you need any more details.

 

A_RECORD =
VAR SELECTED = [vState]
VAR VAR1 = CALCULATE(DISTINCTCOUNT('EMP_TABLE'[EMP_NO]),FILTER(EMP_TABLE, EMP_TABLE[EMP_STATE]=SELECTED
&& (CONTAINSSTRING(EMP_TABLE[TO],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
RETURN
IF(ISBLANK(VAR1),0,VAR1)
 
B_RECORD =
VAR SELECTED = [vState]
VAR VAR1 = CALCULATE(DISTINCTCOUNT('EMP_TABLE'[EMP_NO]),FILTER(EMP_TABLE, EMP_TABLE[EMP_STATE]=SELECTED
&& (CONTAINSSTRING(EMP_TABLE[FROM],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
RETURN
IF(ISBLANK(VAR1),0,VAR1)
 
BalCount = [A_RECORD] - [B_RECORD]
 
Note : Key record is "EMP_NO".

Hi @saivina2920 

 

Your original DurDays column didn't get the correct result because it referred to a wrong column EMP_TABLE[EMP_RELIEVE_DATE] in the DAX. After refering to the correct column as below, it returns the correct results. 

DurDays = IF(EMP_TABLE[EMP_RESIGN_DATE]>[vToday],BLANK(),DATEDIFF(EMP_TABLE[EMP_RESIGN_DATE],TODAY(),DAY))

 

My understanding is that C is to return the number of EMP_NOs which exist in A but don't exist in B. So your BalCount measure is able to be used as a filter field in the table visual. You can set up its value to 1 to determine which one only exists in A.

081701.jpg

 

If you don't want to use BalCount as a filter field, you can use below measure instead to filter the table visual. In this formula, __A/__B/__C are tables which return the distinct EMP_NOs in each group.

Measure C = 
VAR SELECTED = [vState]
VAR __A = CALCULATETABLE(DISTINCT('EMP_TABLE'[EMP_NO]),FILTER(ALL(EMP_TABLE), EMP_TABLE[EMP_STATE]=SELECTED
 && (CONTAINSSTRING(EMP_TABLE[TO],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
VAR __B = CALCULATETABLE(DISTINCT('EMP_TABLE'[EMP_NO]),FILTER(ALL(EMP_TABLE), EMP_TABLE[EMP_STATE]=SELECTED
 && (CONTAINSSTRING(EMP_TABLE[FROM],"IND")) && EMP_TABLE[EMP_STATUS]="Current"))
VAR __C = EXCEPT(__A,__B)
RETURN
IF(SELECTEDVALUE(EMP_TABLE[EMP_NO]) IN __C, 1, 0)

081702.jpg

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Thanks for your excellent result.

saivina2920
Post Prodigy
Post Prodigy

Can any one update on the topic...i am struggling to move further...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.