Forum Discussion
Help Creating DAX Measurements and Tables for Specific Task
- Anonymous2 years ago
Hi eli_dylan ,
If I understand you wrongly, please provide simple data and show the expected results in a picture.
The Table data is shown below:
Please follow these steps:
1.Use the following DAX expression to create a date table
Date = ADDCOLUMNS ( CALENDAR ( MIN ( MIN ( 'ASA_ALI_1'[Date] ), MIN ( 'CLEAN_ASA'[Date of AS] ) ), MAX ( MAX ( 'ASA_ALI_1'[Date] ), MAX ( 'CLEAN_ASA'[Date of AS] ) ) ), "Year-Month", YEAR ( [Date] ) & "-" & MONTH ( [Date] ) )
2. Use the following DAX expression to create a column in table 'CLEAN_ASA'Program = SWITCH(TRUE(), [Housing location] = "SC Bridges","SC Bridges", [Housing location] = "AC st.Lucy's","AC SL" )3.Use the following DAX expression to create measures
Number of ASAs = COUNT(CLEAN_ASA[Date of AS])percentage of ASAs = VAR _Program = SELECTEDVALUE(CLEAN_ASA[Program]) VAR _Capacity = CALCULATE(SUM(ASA_ALI_1[Capacity]),'ASA_ALI_1'[Program] = _Program) RETURN DIVIDE([Number of ASAs],_Capacity)4.Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi eli_dylan ,
If I understand you wrongly, please provide simple data and show the expected results in a picture.
The Table data is shown below:
Please follow these steps:
1.Use the following DAX expression to create a date table
Date =
ADDCOLUMNS (
CALENDAR (
MIN ( MIN ( 'ASA_ALI_1'[Date] ), MIN ( 'CLEAN_ASA'[Date of AS] ) ),
MAX ( MAX ( 'ASA_ALI_1'[Date] ), MAX ( 'CLEAN_ASA'[Date of AS] ) )
),
"Year-Month",
YEAR ( [Date] ) & "-"
& MONTH ( [Date] )
)
2. Use the following DAX expression to create a column in table 'CLEAN_ASA'
Program =
SWITCH(TRUE(),
[Housing location] = "SC Bridges","SC Bridges",
[Housing location] = "AC st.Lucy's","AC SL"
)
3.Use the following DAX expression to create measures
Number of ASAs = COUNT(CLEAN_ASA[Date of AS])percentage of ASAs =
VAR _Program = SELECTEDVALUE(CLEAN_ASA[Program])
VAR _Capacity = CALCULATE(SUM(ASA_ALI_1[Capacity]),'ASA_ALI_1'[Program] = _Program)
RETURN DIVIDE([Number of ASAs],_Capacity)
4.Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is perfect, thank you so much!!