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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Udit
New Member

Convert Calculated Column to measure

Consider the Following Power BI dashboard Model :


We have 3 tables

Table 1 : EM table
There are no duplicate rows in the table.


Table 2 : Norm Table
MaxUpdateFlag1 - is calculated columns

In the table, the below columns are used as filters to obtain the unique value for R_Val.
Cuc ,Date, DMA_Date,P_P,P_T,GT1, R_D

Also, the below columns are used as filters to obtain the unique value for S_Val and T_Val.
Cuc, Date, DMA_Date


Code for MaxUpdateFlag1

MaxUpdateFlag1 =
Var CurrentRow = 'Norm'[DMA_DATE]
VAR MaxUpdate =
CALCULATE(
MAX('Norm'[DMA_Date]),
ALLEXCEPT( 'Norm',
'Norm'[EMID],
'Norm'[DATE],
'Norm'[P_P],
'Norm'[CUC],
'Norm'[GT1],
'Norm'[P_T],
'Norm'[R_T],
'Norm'[R_D]
)
)
RETURN IF(CurrentRow = MaxUpdate, 1, 0)

The third Table is Dates, it is a calculated table with the following code :
Dates = CALENDAR (MIN('Norm Table' [DATE]), MAX('Norm Table' [DATE]))


This is how tables interact together on the relationship model,

EM Table is joined to Norm Table using Column EMID
The relationship is One(EM Table) to Many (Norm Table) in cardinality
Cross-filtering is set to both.

Norm Table is joined to the Dates Table using the Date column
The relationship is One(Dates) to Many (Norm Table) in cardinality, and cross-filtering is set to one-directional.


The matrix visual has the following information in order:
Rows :
E_ID from EM table
EName from EM table
R_D from Norm table
S_Val from Norm table
T_Val from Norm table

Columns :
P_P from Norm Table
R_T from Norm Table

Values :
R_Val from Norm table

In the Filter on this visual section of the matrix

The MaxUpdateFlag1 column from the Norm Table has been added, value is set to 1.

The Idea for setting up the column value to 1 is to display the latest R_Val, S_Val, and T_Val based on the latest information-based  DMA_Date Column.
I am looking to change MaxUpdateFlag1 to a measure.
I have a large dataset and a calculated column is not feasible.
Sample PBIX

1 REPLY 1
lbendlin
Super User
Super User

 

I am looking to change MaxUpdateFlag1 to a measure.

 

Why? Can it be impacted by user interaction with the report?

 

your existing calculated column can be refactored to 

MUF = if([DMA_Date]=maxx(Norm,[DMA_Date]),1,0)

if you want to use a measure, rewrite this to 

MUF = if(SELECTEDVALUE(Norm[DMA_Date])=maxx(Norm,[DMA_Date]),1,0)

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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