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
alsm
Helper III
Helper III

CalculateTable is empty on visual but corresponding Calculate shows correct row count

If I write Calculate with filter, create a visual card and select date, it shows correct count

Num_SelectDetailsRows =
VAR select_date = SELECTEDVALUE(EomDates[Date])
VAR filt_headertbl = CALCULATETABLE(VALUES(HeaderTbl[HeaderKey]), FILTER(HeaderTbl, [ValidFrom] <= select_date && [ValidTo] >= select_date))
VAR filt_detailstbl = CALCULATE(COUNT(DetailsTbl[DetailsKey]), DetailsTbl[HeaderKey] in filt_headertbl)
RETURN
 filt_detailstbl
 
However, if i convert it into a table and show on visual it shows empty
Table =
VAR select_date = SELECTEDVALUE(EomDates[Date])
VAR filt_headertbl = CALCULATETABLE(VALUES(HeaderTbl[HeaderKey]), FILTER(HeaderTbl, [ValidFrom] <= select_date && [ValidTo] >= select_date))
VAR filt_detailstbl = CALCULATETABLE(DetailsTbl, DetailsTbl[HeaderKey] in filt_headertbl)
RETURN
 filt_detailstbl
 
Sample data is 
HeaderTabl
HeaderTbl
HeaderKeyValidFromValidTo
H11Jan202231Dec2022
H215Feb202231Oct2022
H310Mar202215Sep2022
H_FebOnly7Feb202225Feb2022
H_FebMar25Feb2022

14Apr2022

 

DetailsTbl
DetailsKeyHeaderKeyNameCurrency
D1H1AEUR
D2H2BGBP
D3H3CAUD
D4H_FebOnlyDGBP
D5H_FebMarEUSD

 

Dates I try in slicer

Date

31 Dec 2021
31 Jan 2022
28 Feb 2022
31 Mar 2022
30 Apr 2022
31 May 2022
30 Jun 2022
31 Jul 2022
31 Aug 2022
30 Sep 2022
31 Oct 2022
30 Nov 2022

 

What am I missing?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@alsm , A calculated table, can not take the slicer values. that is why the table is empty

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@alsm , A calculated table, can not take the slicer values. that is why the table is empty

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