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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
tiffanyt123
Helper I
Helper I

Sum Row by Row and Bin values into groups

Hi, I have a raw data set where there are multiple lines for each Project ID and Country.

I then grouped this data by Project ID & Country (Market), and aggregated all NTSLC$ values. This is my "Proj Aggregation Test" table in powerBI.

 

tiffanyt123_0-1665552267382.png

 

However, when I create a table in PowerBI, and put the financials, it is giving me the TOTAL value instead of the sum of each line item (eg. first row should be the total financials of the 2 projects in that bin)

 

tiffanyt123_2-1665552304738.png

How do I write a DAX to sum only the rows???

 

 

 

1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

NTSLC SUMS =
VAR selectedRangeMin = SELECTEDVALUE('Proj Value Rank'[MinValue Range])
VAR selectedRangeMax = SELECTEDVALUE('Proj Value Rank'[MaxValue Range])
IF (
    HASONEVALUE ( 'Proj Value Rank'[MinValue Range] ),
    CALCULATE (
       SUM ( 'Proj Aggregation Test'[Sum NTSLC] ),
       FILTER('Proj Aggregation Test',
          'Proj Aggregation Test'[Sum NTSLC] => selectedRangeMin &&
          'Proj Aggregation Test'[Sum NTSLC] < selectedRangeMax
       )
    )      
)

View solution in original post

3 REPLIES 3
lukiz84
Memorable Member
Memorable Member

NTSLC SUMS =
VAR selectedRangeMin = SELECTEDVALUE('Proj Value Rank'[MinValue Range])
VAR selectedRangeMax = SELECTEDVALUE('Proj Value Rank'[MaxValue Range])
IF (
    HASONEVALUE ( 'Proj Value Rank'[MinValue Range] ),
    CALCULATE (
       SUM ( 'Proj Aggregation Test'[Sum NTSLC] ),
       FILTER('Proj Aggregation Test',
          'Proj Aggregation Test'[Sum NTSLC] => selectedRangeMin &&
          'Proj Aggregation Test'[Sum NTSLC] < selectedRangeMax
       )
    )      
)
lukiz84
Memorable Member
Memorable Member

Where is the Value Range Column and how is it connected to your data?

Hi @lukiz84 ,

My Value Range column is from a separate table called "Proj Value Rank" (not connected to any tables):

tiffanyt123_0-1665559407442.png

 

 

I used this message to group projects into bins using this link: 

https://www.burningsuit.co.uk/blog/dax-how-group-measures-numeric-ranges

 

This is my DAX measure based on the above link:

No of Projects = IF(HASONEVALUE('Proj Value Rank'[MinValue Range]), COUNTROWS(FILTER('Proj Aggregation Test', [Sum NTSLC]>=VALUES('Proj Value Rank'[MinValue Range])&& [Sum NTSLC]<values('Proj Value Rank'[MaxValue Range]) ) ), COUNTROWS('Proj Aggregation Test') )
 
THANK YOU!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors