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
CEllis
Resolver I
Resolver I

Total records that are above on or below from a vertical table

 

Is it possible to count the total rows that are above 0 in the OutPut table or below 0 as percentage of the overall total records.

 

SourceTable

NameResultCollection
Name 1872
Name 1921
Name 21072
Name 21101
Name 31061
Name 31072
Name 4852
Name 4941
Name 5992
Name 51071
Name 61051
Name 61072
Name 7962
Name 7991
Name 81082
Name 81111
Name 91111
Name 91142

 

DAX to creat the OutPut

 

Current = 
Var MostRecentCollection = Max('SourceTable'[Collection]
RETURN
        CALCULATE(AVERAGE('SourceTable'[Result]),
            FILTER(
                ALL('SourceTable'[Collection]),
                'SourceTable'[Collection] = MostRecentCollection
            )
        )

 

 

 

Previouse = 
Var MostRecentCollection = Max('SourceTable'[Collection]-1
RETURN
        CALCULATE(AVERAGE('SourceTable'[Result]),
            FILTER(
                ALL('SourceTable'[Collection]),
                'SourceTable'[Collection] = MostRecentCollection
            )
        )

 

OutPut

NameCurrentPreviouseDifference
Name 192875
Name 21101073
Name 3106107-1
Name 494859
Name 5107998
Name 6105107-2
Name 799963
Name 81111083
Name 9111114-3

 

This is the bit I am getting stuck on.

 

% of rows that are above 0  (6/9=67%)
% of rows that are below 0  (3/9=33%)

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-jingzhan-msft
Community Support
Community Support

Hi @CEllis 

 

You can try these measures

% above 0 = 
VAR _table = SUMMARIZE('SourceTable','SourceTable'[Name],"Diff",[Difference])
VAR _allRows = COUNTROWS(_table)
VAR _aboveRows = COUNTROWS(FILTER(_table,[Diff]>0))
RETURN
DIVIDE(_aboveRows,_allRows)
% below 0 = 
VAR _table = SUMMARIZE('SourceTable','SourceTable'[Name],"Diff",[Difference])
VAR _allRows = COUNTROWS(_table)
VAR _belowRows = COUNTROWS(FILTER(_table,[Diff]<0))
RETURN
DIVIDE(_belowRows,_allRows)

vjingzhanmsft_0-1709000688137.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
v-jingzhan-msft
Community Support
Community Support

Hi @CEllis 

 

You can try these measures

% above 0 = 
VAR _table = SUMMARIZE('SourceTable','SourceTable'[Name],"Diff",[Difference])
VAR _allRows = COUNTROWS(_table)
VAR _aboveRows = COUNTROWS(FILTER(_table,[Diff]>0))
RETURN
DIVIDE(_aboveRows,_allRows)
% below 0 = 
VAR _table = SUMMARIZE('SourceTable','SourceTable'[Name],"Diff",[Difference])
VAR _allRows = COUNTROWS(_table)
VAR _belowRows = COUNTROWS(FILTER(_table,[Diff]<0))
RETURN
DIVIDE(_belowRows,_allRows)

vjingzhanmsft_0-1709000688137.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

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.