Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Project | Code | Flag |
1 | A | 1 |
1 | B | 1 |
1 | C | 1 |
2 | B | 1 |
2 | C | 1 |
3 | D | 0 |
3 | F | 0 |
3 | Q | 0 |
4 | B | 1 |
5 | A | 0 |
6 | C | 0 |
I want to create a caculated column Flag, If project contains Code B then all records in project will be flgged as 1. By the way, If the requirment is measure,how to create?
Solved! Go to Solution.
@Anonymous Maybe:
Column =
VAR __Project = [Project]
VAR __Codes = DISTINCT(SELECTCOLUMNS(FILTER('Table',[Project]=__Project),"Code",[Code]))
RETURN
IF("B" IN __Codes,1,0)
Measure =
VAR __Project = MAX([Project])
VAR __Codes = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table'),[Project]=__Project),"Code",[Code]))
RETURN
IF("B" IN __Codes,1,0)
Hi,
This calculated column works as well
=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Project]=EARLIER(Data[Project])&&Data[Code]="B"))>0,1,0)
Hope this helps.
@Anonymous Maybe:
Column =
VAR __Project = [Project]
VAR __Codes = DISTINCT(SELECTCOLUMNS(FILTER('Table',[Project]=__Project),"Code",[Code]))
RETURN
IF("B" IN __Codes,1,0)
Measure =
VAR __Project = MAX([Project])
VAR __Codes = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table'),[Project]=__Project),"Code",[Code]))
RETURN
IF("B" IN __Codes,1,0)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |