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
Anonymous
Not applicable

Group by in Dax

 

SQL

Select BalanceDAte, Sum(CurrentBalance) FROM [dbo].[VW_RPT_PortfolioReview_6Month]
Where
Pool ='Java' AND

CATEGORY1 not in (
'Closed Full Redemption','Closed with remaining shortfall'
)
group by
BalanceDate

 

I want to group by BalanceDate,

 

 

CALCULATE(SUM(VW_RPT_PortfolioReview_6Month[CurrentBalance]),
FILTER( 
	ALLEXCEPT(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[POOL],VW_RPT_PortfolioReview_6Month[BalanceDate]), 
    VW_RPT_PortfolioReview[CATEGORY1]<>"Closed with remaining shortfall" 
		)
	)

I am confused when to use Sumx or Group by , why SumX is not grouping by Row 

 

Attempt at SUMX

CALCULATE(SUMX(FILTER(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[CATEGORY1] <>"Closed with remaining shortfall" && VW_RPT_PortfolioReview_6Month[CATEGORY1]<>"Closed Full Redemption"
), VW_RPT_PortfolioReview_6Month[CurrentBalance]),ALLEXCEPT(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[POOL]))

 

 

Attempt at Group BY

 

 

GROUPBY(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[BalanceDate],"Name",CALCULATE(SUM(VW_RPT_PortfolioReview_6Month[CurrentBalance]),
FILTER(
    ALLEXCEPT(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[POOL]),VW_RPT_PortfolioReview_6Month[CATEGORY1] <>"Closed with remaining shortfall" && VW_RPT_PortfolioReview_6Month[CATEGORY1]<>"Closed Full Redemption"
    )))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Figured it out CALCULATE(SUMX(FILTER(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[CATEGORY1] <>"Closed with remaining shortfall" && VW_RPT_PortfolioReview_6Month[CATEGORY1]<>"Closed Full Redemption" ), VW_RPT_PortfolioReview_6Month[CurrentBalance]),ALLEXCEPT(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[POOL],VW_RPT_PortfolioReview_6Month[BalDateMonthName]))

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi

Very happy to see the issue solved by yourself.

It is very generous of you to share the solution here so that other prople may benefit from this thread.

 

Best Regards

Maggie

Anonymous
Not applicable

Figured it out CALCULATE(SUMX(FILTER(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[CATEGORY1] <>"Closed with remaining shortfall" && VW_RPT_PortfolioReview_6Month[CATEGORY1]<>"Closed Full Redemption" ), VW_RPT_PortfolioReview_6Month[CurrentBalance]),ALLEXCEPT(VW_RPT_PortfolioReview_6Month,VW_RPT_PortfolioReview_6Month[POOL],VW_RPT_PortfolioReview_6Month[BalDateMonthName]))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.