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.
Hello,
Essentially I am trying to create an if statement based on a slicers selected value. Below you can find a mock up of my data.
ID | Start | End | New |
1 | Red | Blue | 1 |
2 | Red | Blue | 1 |
3 | Red | Blue | 1 |
4 | Red | Blue | 1 |
5 | Red | Blue | 0 |
6 | Red | Blue | 0 |
Ideally I want a slicer for the New column and I want the syntax to read
IF(NEW = 1,
(VAR
Rankingcontext = Values(Table1[Start])
Return
CALCULATE(count(Table1[ID]),
TOPN(2,
ALL(table1[Start]),
Count(Table1[ID])),
Rankingcontext )),
(VAR
Rankingcontext = Values(Table1[end])
Return
CALCULATE(count(Table1[ID]),
TOPN(2,
ALL(table1[end]),
Count(Table1[ID])),
Rankingcontext )))
Solved! Go to Solution.
Hi @jday,
After research, you can follow the steps.
1. Create a slicer including [New] column.
2. Create two measures using the formular.
END_Start = IF ( SELECTEDVALUE ( Table1[New] ) = 1, FIRSTNONBLANK ( Table1[Start], Table1[Start] ), FIRSTNONBLANK ( Table1[End], Table1[End] ) ) ID COUNT = IF ( ISFILTERED ( Table1[New] ), COUNT ( Table1[End] ), CALCULATE ( COUNT ( Table1[Start] ), FILTER ( Table1, Table1[New] <> 1 ) ) )
Then, create a table visual, select the two measures, you will get expected result as follows.
You can download the .pbix(attachment) for checking more details.
Best Regards,
Angelia
Hi @jday,
It's hard to understand your requirement, what result do you want to return? Could you please clear up your requirement, so that we can help you in details.
Thanks,
Angelia
If a slicer is applied for "New" and 1 is selected then I want the a table to show
END ID COUNT
Red 4
If 1 is not selected then I want the results to be
End ID COUNT
Blue 2
Hi @jday,
After research, you can follow the steps.
1. Create a slicer including [New] column.
2. Create two measures using the formular.
END_Start = IF ( SELECTEDVALUE ( Table1[New] ) = 1, FIRSTNONBLANK ( Table1[Start], Table1[Start] ), FIRSTNONBLANK ( Table1[End], Table1[End] ) ) ID COUNT = IF ( ISFILTERED ( Table1[New] ), COUNT ( Table1[End] ), CALCULATE ( COUNT ( Table1[Start] ), FILTER ( Table1, Table1[New] <> 1 ) ) )
Then, create a table visual, select the two measures, you will get expected result as follows.
You can download the .pbix(attachment) for checking more details.
Best Regards,
Angelia
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |