The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi community,
Can you please help me writing following in measure and Column.
I have product two products in data ( F and NF) . I want create measure and column where I could identify customer has converted from NF to F. I have two years of data and cut of time to look NF product is 365 days. that means if customer has acquired F product then code check product NF in last one years of product F acquired date.
ID | Product Name | Date | Product F Aquired | NF -> F
1 NF 2020/Sept/ 2 N
1 F 2021/Jan/1 Y Y
2 NF 2020/Feb/2020 N
2 F 2021/Dec /2021 Y N
3 NF 20/ March/2021 N
3 F 20/July/2021 Y Y
Thanks,
Chans.
Solved! Go to Solution.
HI @Anonymous,
Did you mean the condition are based on the two products that were stored in two different years? If that is the case, you can try to use the following calculated column formulas:
NF to F =
IF (
'Table'[Product] = "F",
VAR prevNFDate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
[ID] = EARLIER ( 'Table'[ID] )
&& [Date] < EARLIER ( 'Table'[Date] )
&& 'Table'[Product] = "NF"
)
)
RETURN
IF ( YEAR ( 'Table'[Date] ) - YEAR ( prevNFDate ) >= 1, "Y", "N" )
)
Regards,
Xiaoxin Sheng
HI @Anonymous,
Did you mean the condition are based on the two products that were stored in two different years? If that is the case, you can try to use the following calculated column formulas:
NF to F =
IF (
'Table'[Product] = "F",
VAR prevNFDate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
[ID] = EARLIER ( 'Table'[ID] )
&& [Date] < EARLIER ( 'Table'[Date] )
&& 'Table'[Product] = "NF"
)
)
RETURN
IF ( YEAR ( 'Table'[Date] ) - YEAR ( prevNFDate ) >= 1, "Y", "N" )
)
Regards,
Xiaoxin Sheng
Hi @Anonymous
Not enough information to go on;
please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables
Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/
User | Count |
---|---|
15 | |
13 | |
7 | |
6 | |
5 |
User | Count |
---|---|
24 | |
20 | |
12 | |
9 | |
7 |