Cumulative calculation in power BI using DAX funtion - powerbi

I want to get count that lower date value from one table comparing date value from another table.
My first table Says NewStateTable,
WorkItemId
Title
ChangedDate
State
StateChangeDate
AreaPath
27997
logo in Code Provider Access
16-03-2021 19:25
New
12-03-2021 21:53
power
28339
Password policy needs to be updated
12-03-2021 21:54
New
12-03-2021 21:54
power
28464
Update Names of users names
12-03-2021 21:54
New
12-03-2021 21:54
power
29918
Add capturing capabilities on the Public Portal
24-03-2021 17:27
New
23-02-2021 21:53
power
29919
Refactor the code to make sure that the generated value done in a single location.
23-02-2021 21:55
New
23-02-2021 21:55
Empower
29943
Placeholder : "Provider Search Compare" needs to added on the Public Portal
11-03-2021 17:58
New
23-02-2021 22:26
power
29948
Add Document upload feature
23-02-2021 22:51
New
23-02-2021 22:51
power
My another table Says AllIterationTable,
AreaPath
IterationPath
StartDate
EndDate
power
power - Sprint1
08-03-2021 00:00
13-03-2021 00:00
power
power - Sprint 3
15-03-2021 00:00
20-03-2021 00:00
power
power - Migration
22-03-2021 00:00
27-03-2021 00:00
power
power - License
29-03-2021 00:00
03-04-2021 00:00
Now I want cumulative count of all WorkItemId in custom column of AllIterationTable where NewStateTable[ChangedDate] less than AllIterationTable[StartDate]
So I applied Dax function but it won't work for me,
ChangedDateBeforeSprintStart = COUNTROWS(FILTER(ALL(NewStateTable), NewStateTable[ChangedDate] <= AllIterationTable[StartDate]))
What should be my DAX function mapping two tables using Date condition and creating custom column in a table.

Try this :
= CALCULATE(COUNTROWS(NewStateTable), FILTER(NewStateTable, NewStateTable[ChangedDate] < (AllIterationTable[StartDate]) ))

Related

SSAS/ PowerBi / DAX - How to combine multiplie colunms in one

I am using Power Bi with SSAS Tubular Model.
I have a table that causes duplication due to multiple managers on a project.
Projekt Manager Revenue
Car-Sales Bob 200k
Car-Sales Chris 200k
Car-Sales Tina 200k
I want to combine these Manager entries to one entry with commas.
Projekt Manager Revenue
Car-Sales Bob,Chris,Tina 200k
How do I write this in DAX?
This should be done upstream in your data shaping stage but if you're stuck with DAX, then create a new table as follows:
Table 2 = ADDCOLUMNS( SUMMARIZE('Table', 'Table'[Projekt], 'Table'[Revenue]), "Manager", CONCATENATEX('Table', 'Table'[Manager], ","))

One slicer for 2 tables power BI

I have two tables, first contains all AreaPath data module wise,
WorkItemId
Title
ChangedDate
State
StateChangeDate
AreaPath
27997
logo in Code Provider Access
16-03-2021 19:25
New
12-03-2021 21:53
Admin
28339
Password policy needs to be updated
12-03-2021 21:54
New
12-03-2021 21:54
power
28464
Update Names of users names
12-03-2021 21:54
New
12-03-2021 21:54
Admin
29918
Add capturing capabilities on the Public Portal
24-03-2021 17:27
New
23-02-2021 21:53
power
29919
Refactor the code to make sure that the generated value done in a single location.
23-02-2021 21:55
New
23-02-2021 21:55
Empower
29943
Placeholder : "Provider Search Compare" needs to added on the Public Portal
11-03-2021 17:58
New
23-02-2021 22:26
power
29948
Add Document upload feature
23-02-2021 22:51
New
23-02-2021 22:51
power
And i have 2nd table contains AllIteration,
AreaPath
IterationPath
StartDate
EndDate
power
power - Sprint1
08-03-2021 00:00
13-03-2021 00:00
Empower
power - Sprint 3
15-03-2021 00:00
20-03-2021 00:00
power
power - Migration
22-03-2021 00:00
27-03-2021 00:00
Admin
power - License
29-03-2021 00:00
03-04-2021 00:00
Using above table I have created one line graph and one multirow card in a single page. I added slicer for AreaPath to categories wise I can see graphs. But the issue is I can only use slicer for belongs to one graph and table. How we can change value of other graph using slicer?

DAX function on two table to count rows

I want to get count that lower date value from one table comparing date value from another table.
My first table Says NewStateTable,
WorkItemId
Title
ChangedDate
State
StateChangeDate
AreaPath
27997
logo in Code Provider Access
16-03-2021 19:25
New
12-03-2021 21:53
power
28339
Password policy needs to be updated
12-03-2021 21:54
New
12-03-2021 21:54
power
28464
Update Names of users names
12-03-2021 21:54
New
12-03-2021 21:54
power
29918
Add capturing capabilities on the Public Portal
24-03-2021 17:27
New
23-02-2021 21:53
power
29919
Refactor the code to make sure that the generated value done in a single location.
23-02-2021 21:55
New
23-02-2021 21:55
Empower
29943
Placeholder : "Provider Search Compare" needs to added on the Public Portal
11-03-2021 17:58
New
23-02-2021 22:26
power
29948
Add Document upload feature
23-02-2021 22:51
New
23-02-2021 22:51
power
My another table Says AllIterationTable,
AreaPath
IterationPath
StartDate
EndDate
power
power - Sprint1
08-03-2021 00:00
13-03-2021 00:00
power
power - Sprint 3
15-03-2021 00:00
20-03-2021 00:00
power
power - Migration
22-03-2021 00:00
27-03-2021 00:00
power
power - License
29-03-2021 00:00
03-04-2021 00:00
Now I want count of all WorkItemId in custom column of AllIterationTable where NewStateTable[ChangedDate] less than AllIterationTable[StartDate]
So I applied Dax function but it won't work for me,
Column = COUNTROWS(FILTER(NewStateTable, NewStateTable[ChangedDate] < EARLIER(AllIterationTable[StartDate])))+1
What should be my DAX function mapping two tables using Date condition and creating custom column in a table.
Calculated Column in AllIterationTable:
MyCol =
COUNTROWS(
FILTER(
ALL( NewStateTable ),
NewStateTable[ChangedDate] < AllIterationTable[StartDate]
)
)

Power Bi forecast projected sales accross days / months between a date range

I am trying to create a monthly forecast for a list of clients that have different start and end dates for their spending.
I am able to create a formula that would work in excel, but am learning Power Bi and having troubles converting the formula to something that would work inside Power Bi without adding the formula to excel file. Column A-F are how the raw data is delivered. Columns G-R are columns that i am trying to avoid adding thru a Dax formula
Pending Sample excel data
it might help if you unpivot the prorate monthly amounts in power query first (since narrow tables better than wide tables)
client Start Date End Date PendingMarket$ PendingShare Month Value
Client 1 3/1/2021 3/1/2021 $10,618 3.0% jan 0
Client 1 3/1/2021 3/1/2021 $10,618 3.0% feb 0
Client 1 3/1/2021 3/1/2021 $10,618 3.0% mar 319
then the dax formulae is easy
for a calculated column on the table:
Pending Station $ (Prorated) = CALCULATE(SUM(MyTableName[Value]), [Strat Date] = Earlier([Start Date], [End Date] = Earlier[End Date], [Client] = Earlier[Client])
PN earlier get the value of current row for column value

Power BI: how to select all columns where date is greater in Power BI

I'm a newbie I have just started using power bi. I have a table 'users' with a column name 'Date' and some other columns. I want to select the latest record where Date is largest. I don't know how to accomplish this with dax or power query. Really appreciate any sort of help.
Table
ID AddedDate Value
1 2018/11/01 00:00 105
2 2018/11/02 00:00 101
3 2018/11/03 00:00 101
Output
ID AddedDate Value
3 2018/11/03 00:00 101
DAX measure formula (make sure it's a Measure, not a calculated column):
Latest Value =
VAR
Latest_Date = CALCULATE ( MAX ( Users[AddedDate] ), ALL ( Users ) )
RETURN
CALCULATE ( SUM ( Users[Value] ), Users[AddedDate] = Latest_Date )
Result:
How it works:
First, we find the latest date by looking for a max date in the entire (unfiltered) table, and save it in a variable.
Second, we tell DAX to sum only values where date is equal to the latest date we have saved.