remove/filter data from power bi modeling tab - powerbi

I have a very large data set and would like to remove n rows from the bottom up.
For example, if I had 15 numbers: 1 1 2 3 4 5 5 6 7 7 7 8 8 9 9, and I want to remove 5 entries from the bottom, being 7 8 8 9 9.
How can I do this in dax, remove/filter out n rows from the bottom of my data?
Thanks

Related

Create the Mapping and Display Runs For Each Over and I Also Add First Over Runs in the Sum of Second Over Runs and Same for Third Over

Source table Cricket_Score:
Overs
Balls
Runs
1
1
1
1
2
2
1
3
4
1
4
0
1
5
1
1
6
2
2
1
3
2
2
1
2
3
1
2
4
4
2
5
6
2
6
0
3
1
2
3
2
1
3
3
1
3
4
6
3
5
0
3
6
4
I Want to an output like this:
Overs
Total_Runs
1
10
2
25
3
39
Description: - For First Over means First 6 Balls I Want Sum of First 6 Balls that is 10. and For Second 6 Balls I Want Sum of First 6 Balls [Over] + Second 6 Balls That is 25 [10 + 15 = 25]. and For Third 6 Balls I Want Sum of First 6 Balls [Over] + Second 6 Balls + Third ^ Balls That is 39 [10 + 15 + 14 = 39].
Note: - 6 balls means one over.
How to create a mapping in for this scenario in Informatica / which logic should I use?
i will assume your data is EXACTLY like you have shown in your question. If its not like this in source then it will be a major issue. If its a table where data is not sorted, it will be an issue.
Solution -
Create an expression transformation with below ports - in below order. in - input port, v_variable port, out_* output port
in_balls
in_runs
in_overs
v_cumulative_runs= in_runs+ iif(isnull(v_cumulative_run),0,v_cumulative_run)
out_total_runs=v_cumulative_runs
out_overs=in_overs
Use an aggregator -
in_total_runs
in_out_overs -- group by this port
out_total_runs = max(in_total_runs)
Attach in_out_overs and out_total_runs links to target.

Google Sheets formula for summing/averaging with specific conditions

I am hoping for a formula to take hours from the name columns and sum/average them by week, into a separate table like the 2nd one below. The formulas need to update upon changing the start and end week cells.
Body Part
Start Week
End Week
Arnold (hours)
Usain (hours)
Bob (hours)
Arms
1
3
6
3
0
Legs
1
6
12
36
20
Chest
2
4
6
2
2
Booty
4
6
9
12
3
Core
1
5
10
5
5
Formula Needed:
Hours
Arnold
Usian
Bob
Week 1
6
8
4.33
Week 2
8
8.67
5
Week 3
8
8.67
5
Week 4
9
11.67
6
Week 5
7
11
5.33
Week 6
5
10
4.33
Bonus if there is a way to also quickly average hours by body parts if for example there are multiple Arms rows.
try:
=ARRAYFORMULA(LAMBDA(a, b, QUERY(SPLIT(FLATTEN(BYCOL(D1:F1, LAMBDA(xx, FLATTEN(IF(
IF(a>=SEQUENCE(1, MAX(a)), "Week "&TEXT(SEQUENCE(1, MAX(a))+b, "00"), )="",,
REGEXEXTRACT(OFFSET(xx,,,1), "(.+) \(")&"×"&
IF(a>=SEQUENCE(1, MAX(a)), "Week "&TEXT(SEQUENCE(1, MAX(a))+b, "00"), )&"×"&
QUERY({REGEXEXTRACT(OFFSET(xx,,,1), "(.+) \("); OFFSET(xx,1,,9^9)/(a)}, "offset 1", )))))), "×"),
"select Col2,sum(Col3) where Col3>0 group by Col2 pivot Col1"))
(C2:INDEX(C:C, MAX(ROW(C:C)*(C:C<>"")))-B2:INDEX(B:B, MAX(ROW(B:B)*(B:B<>"")))+1,
B2:INDEX(B:B, MAX(ROW(B:B)*(B:B<>"")))-1))

cumulative average powerbi by month

I have below dataset.
Math Literature Biology date student
4 2 5 2019-08-25 A
4 5 4 2019-08-08 A
5 4 5 2019-08-23 A
5 5 5 2019-08-15 A
5 5 5 2019-07-19 A
5 5 5 2019-07-15 A
5 5 5 2019-07-03 A
5 5 5 2019-06-26 A
1 1 2 2019-06-18 A
2 3 3 2019-06-14 A
5 5 5 2019-05-01 A
2 1 3 2019-04-26 A
I need to develop a solution in powerbi so in output I have cumulative average per subject per month
For example
April May June July August
Math | 2 3.5 3 3.75 4
Literature | 1 3 3 3.75 3.83
Biology | 3 4 3.6 4.125 4.33
Can you help?
You can use a matrix visualization for this.
Create a month-year variable and use it in the columns.
Use Average of Math,Literature and Biology in values
Under the format pane --> Values --> Show on rows --> Select this
This should give the view you are looking for. You can edit the value headers to your requirement.

Show 90% percentile in Bar Charts Power BI

My Data is like this
User_ID Stage_1 Stage_2 Stage_3 StagesTotal
---------------------------------------------------
U000 3 9 8 20
U111 5 7 2 14
U222 3 6 5 14
U333 6 5 8 19
U444 8 4 6 18
U555 2 7 7 16
U666 5 5 4 14
------------------------------------------------------
I have a bar chart that shows the median
That is good
instead of the median i want to show the 90% percentile
I tried creating a new measures
Stage1_90Perc = PERCENTILE.EXC(Stages[Stage1],90)
Stage2_90Perc = PERCENTILE.EXC(Stages[Stage2],90)
Stage3_90Perc = PERCENTILE.EXC(Stages[Stage3],90)
StagesTotal_90Perc = PERCENTILE.EXC(Stages[StagesTotal],90)
When I add the new meseare to my chart it breaks
it becomes like this
bu the chart turns to this
my question is how to display the 90% percentile in that report data
Note : the 90% measure will be used in many other charts once it is fixed
You have entered what I believe to be a simple mistake where you wrote (Stages[Stage],90) :
Stage_90Perc = PERCENTILE.EXC(Stages[Stage],90)
It should be this instead :
Stage_90Perc = PERCENTILE.EXC(Stages[Stage], .90)

Conditional cumulative sum in SAS

I have been searching the solution a while, but I couldn't find any similar question in SAS in communities.
I have the following table in SAS. I need to get the cumulative value by Date. Most importantly, I need the cumulative value starts from new once it exceeds 10.
Date Number
01/01/2017 3
01/01/2017 1
01/01/2017 3
01/01/2017 4
01/01/2017 6
01/01/2017 8
02/01/2017 6
02/01/2017 3
02/01/2017 5
02/01/2017 7
03/01/2017 4
03/01/2017 3
... ...
I need my output table looks like this. Just one more column shows the cumulative values.
Date Number cumulative
01/01/2017 3 3
01/01/2017 1 4
01/01/2017 3 7
01/01/2017 4 4 <---- (starts from new)
01/01/2017 6 10
01/01/2017 8 8
02/01/2017 6 6
02/01/2017 3 9
02/01/2017 5 5
02/01/2017 7 7 <---- (starts from new)
03/01/2017 4 3
03/01/2017 3 7
... ... ...
Would someone be able to assist with this.
Thanks
Something like (untested):
data out;
set in;
by date; * Assumes sorted by date;
retain cumulative;
if first.date or cumulative+number > 10 then do;
cumulative = 0;
end;
cumulative = cumulative + number;
run;
should work...