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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

CalculateTable help

I need to return a calculate table with the datarows highlighted below. Basically All rows from the table where Marker =1 
The column Marker is a DAX measure . 

Report
Date
 EDW
CustomerID
 IndexRow 
Measure
 Marker
8/31/2020 0:00 3 1 0
9/30/2020 0:00 3 2 0
10/31/2020 0:00 3 3 0
11/30/2020 0:00 3 4 0
4/30/2021 0:00 3 5 1
8/31/2020 0:00 4 1 0
9/30/2020 0:00 4 2 0
10/31/2020 0:00 4 3 0
11/30/2020 0:00 4 4 0
4/30/2021 0:00 4 5 1
8/31/2020 0:00 5 1 0
9/30/2020 0:00 5 2 0
10/31/2020 0:00 5 3 0
11/30/2020 0:00 5 4 0
4/30/2021 0:00 5 5 1
8/31/2020 0:00 6 1 0
9/30/2020 0:00 6 2 0
10/31/2020 0:00 6 3 0
11/30/2020 0:00 6 4 0
4/30/2021 0:00 6 5 1

 

Please help me use CalculatetAble DAX to return a table 

Thanks in Advance.
5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

This should work

New Table = CALCULATETABLE ( Table , Table[Marker] = 1 )


or this

New Table = FILTER ( Table , Table[Marker] = 1 )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks for your Reply @Fowmy .

 

But the CALCULATETBALE expression the way you mentioned above gives me an error 

ishanab_0-1629443076635.png

Not sure why ? and how to get rid of this error?
Is this becasue IndexRow Measure is a DAX measure with zeros/ones value? 
Please help me understand this error as well the best possible approach to achieve the desired output
Thanks 

@Anonymous 

First, you need to be clear about creating tables and measures. When you create a table to add to your model, you are not supposed to use measures as measures are calculated once you complete adding the tables.  Measures work on the filter context present in your report environment. 

Let me know the calculation for your [Marker] measure, then you can create a new table by adding this measure in your new table.

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks for the reply @Fowmy . 
To give you full context of the scenario...the table above has two DAX  measures , Index Row Measure and Marker ..why I need to keep it that way is becasue my data changes based on the date slicer ....So as you can imagine the IndexRow Measure value will change if the date range selected by the user is different from the one shown above in the table . 

Calculations for the both the DAX Measures is as shown below ::::

Marker =
VAR intIndex = [Index]
VAR intCustomerID = SELECTEDVALUE('Member Channel Utilization'[EDWCustomerID])
VAR dteReport = SELECTEDVALUE('Member Channel Utilization'[Report Date])
VAR dteMax = CALCULATE(
MAX('Member Channel Utilization'[Report Date])
, ALLSELECTED('Member Channel Utilization')
, 'Member Channel Utilization'[EDWCustomerID] = intCustomerID
)
VAR boolMatch = IF(dteReport = dteMax, 1, 0)
RETURN
boolMatch
 
 
IndexRow Measure = CALCULATE(
IF ( ISBLANK ( COUNTROWS ('Member Channel Utilization' ) ), 0, COUNTROWS ('Member Channel Utilization') ),
FILTER(
ALLSELECTED( 'Member Channel Utilization' ),
('Member Channel Utilization'[Report Date]) <= MIN('Member Channel Utilization'[Report Date]) && ('Member Channel Utilization'[EDWCustomerID]) = MIN( 'Member Channel Utilization'[EDWCustomerID] )
)
)
Taking into consideration that i have these two measures on my table ....
Is it possible to build a calculate table and/or a temp table which captures the records that are set to 1.
Please clarify /help understand....

Thanks

HI @Anonymous ,

 

You have mentioned you need to calculatetable where marker = 1 right? So your code would be like below:-

member_channel_new = 
CALCULATETABLE (
    'Member channel Utilization',
    'Member channel Utilization'[marker] = 1
)

image.png

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.