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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Lharfenes
Frequent Visitor

Help with a calculated table

Lharfenes_0-1694025954816.png

Hi, I am in need of creating a calculated table based off other tables. 

Screenshot supplied above for clarity.

 

Thank you.

7 REPLIES 7
Lharfenes
Frequent Visitor

Thank you so much for your interest in helping me!

Below is the link to the file. Please let me know if you are having issues accessing it.

Thanks in

 

https://hamaspikk-my.sharepoint.com/:f:/g/personal/lharfenes_hamaspikkings_org/EnRCip7LXj9Mvgv5Rnlf-...

sorry, the link asks for a login.

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Can you send me your email and I will send you the file?

The simplest way is to "borrow"  the DAX for the visual

 

// DAX Query
DEFINE
	VAR __DS0Core = 
		SUMMARIZECOLUMNS(
			ROLLUPADDISSUBTOTAL(ROLLUPGROUP('Date'[Date], 'CC'[Department]), "IsGrandTotalRowTotal"),
			"SumAmount", CALCULATE(SUM('Expenses'[Amount])),
			"DistinctCountName", CALCULATE(DISTINCTCOUNT('Employees'[Name])),
			"Expense_Per_Employee", 'Expenses'[Expense Per Employee]
		)

	VAR __DS0PrimaryWindowed = 
		TOPN(502, __DS0Core, [IsGrandTotalRowTotal], 0, 'Date'[Date], 1, 'CC'[Department], 1)

EVALUATE
	__DS0PrimaryWindowed

ORDER BY
	[IsGrandTotalRowTotal] DESC, 'Date'[Date], 'CC'[Department]

lbendlin_0-1694469148753.png

 

You can simplify it because you don't need the totals

 

// DAX Query
DEFINE
	VAR __DS0Core = 
		SUMMARIZECOLUMNS(
			'Date'[Date],
			'CC'[Department],
			"SumAmount", CALCULATE(SUM('Expenses'[Amount])),
			"DistinctCountName", CALCULATE(DISTINCTCOUNT('Employees'[Name])),
			"Expense_Per_Employee", 'Expenses'[Expense Per Employee]
		)

	VAR __DS0PrimaryWindowed = 
		TOPN(501, __DS0Core, 'Date'[Date], 1, 'CC'[Department], 1)

EVALUATE
	__DS0PrimaryWindowed

ORDER BY
	'Date'[Date], 'CC'[Department]

 

and then you can refactor it some more in DAX Studio

lbendlin_1-1694469270473.png

So your new table would be 

 

New Table = SUMMARIZECOLUMNS(
			'Date'[Date],
			'CC'[Department],
			"SumAmount", CALCULATE(SUM('Expenses'[Amount])),
			"DistinctCountName", CALCULATE(DISTINCTCOUNT('Employees'[Name])),
			"Expense_Per_Employee", 'Expenses'[Expense Per Employee]
		)

lbendlin_2-1694469338525.png

 

 

see attached.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors