The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I think its a very simple solution but I can't get the answer
ID | Description | Date |
CS | Programmed | 2/2/2023 |
CS | Purchase | 2/2/2023 |
CS | Programmed | 3/10/2023 |
CS | Programmed | 5/9/2023 |
CS | Purchase | 4/14/2023 |
CJ | Programmed | 1/30/2023 |
CJ | Purchase | 1/30/2023 |
CJ | Programmed | 6/9/2023 |
CJ | Purchase | 5/19/2023 |
CI | Purchase | 5/19/2023 |
CI | Purchase | 6/20/2023 |
CI | Programmed | 4/28/2023 |
CI | Programmed | 6/21/2023 |
I want to count the amount of purchase that were made in the same day of the programmed by ID and then divide by another measure
This is what I have for now but I think I'm overcomplicating
Solved! Go to Solution.
Helped me with this solution
You have to create 2 measures.
The first one would be to create a measure filtering by Programmed
Programmed = COUNTROWS(FILTER(Data, Data[Description] = "Programmed"))
then create another measure that counts the days that are the same
On Same Date =
COUNTROWS(FILTER(Data, not(ISBLANK([Programmed])) && not(ISBLANK(countx(filter(all(data), Data[ID] = EARLIER(Data[ID]) && Data[Date] = EARLIER(Data[Date]) && Data[Description] = "Purchase"), Data[ID])))))
I followed everything, just changed
Data[Evento] = "Programmed"
to
Data[Description] = "Programmed"
because it's in the same column but I receive this error message.
A single value for column 'Evento' in table 'Data completa' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
Helped me with this solution
You have to create 2 measures.
The first one would be to create a measure filtering by Programmed
Programmed = COUNTROWS(FILTER(Data, Data[Description] = "Programmed"))
then create another measure that counts the days that are the same
On Same Date =
COUNTROWS(FILTER(Data, not(ISBLANK([Programmed])) && not(ISBLANK(countx(filter(all(data), Data[ID] = EARLIER(Data[ID]) && Data[Date] = EARLIER(Data[Date]) && Data[Description] = "Purchase"), Data[ID])))))
Hi @Anonymous ,
Try it:
% of compliance =
VAR _ProgrammedDates =
FILTER(
VALUES(Data[Date]),
Data[Evento] = "Programmed"
)
RETURN
DIVIDE(
COUNTX(
FILTER(
ALL(Data),
Data[Description] = "Purchase"
&& Data[Date] IN _ProgrammedDates
),
Data[ID]
),
[Amount of weeks programmed to today]
)
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |