The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
In calendar_dimension table, I tried to create Group Quarter-Year calculated column and Group Quarter-Year sort calculated column.
Group Quarter-Year =
VAR _today =
TODAY ()
VAR _indexquarteryear =
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
VAR _todayindex =
MAXX (
FILTER (
ADDCOLUMNS (
calendar_dim,
"@indexquarteryear",
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
),
calendar_dim[date] = _today
),
[@indexquarteryear]
)
RETURN
SWITCH (
TRUE (),
_indexquarteryear <= _todayindex
&& _indexquarteryear >= _todayindex - 2, "Current Engagement",
_indexquarteryear <= _todayindex - 3
&& _indexquarteryear >= _todayindex - 5, "Initial Interactions",
_indexquarteryear <= _todayindex - 6, "Purchased",
_indexquarteryear > _todayindex, "Future ML prediction",
"Check again"
)
Group Quarter-Year sort =
VAR _today =
TODAY ()
VAR _indexquarteryear =
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
VAR _todayindex =
MAXX (
FILTER (
ADDCOLUMNS (
calendar_dim,
"@indexquarteryear",
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
),
calendar_dim[date] = _today
),
[@indexquarteryear]
)
RETURN
SWITCH (
TRUE (),
_indexquarteryear <= _todayindex
&& _indexquarteryear >= _todayindex - 2, 0,
_indexquarteryear <= _todayindex - 3
&& _indexquarteryear >= _todayindex - 5, -1,
_indexquarteryear <= _todayindex - 6, -2,
_indexquarteryear > _todayindex, 1,
100
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
In calendar_dimension table, I tried to create Group Quarter-Year calculated column and Group Quarter-Year sort calculated column.
Group Quarter-Year =
VAR _today =
TODAY ()
VAR _indexquarteryear =
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
VAR _todayindex =
MAXX (
FILTER (
ADDCOLUMNS (
calendar_dim,
"@indexquarteryear",
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
),
calendar_dim[date] = _today
),
[@indexquarteryear]
)
RETURN
SWITCH (
TRUE (),
_indexquarteryear <= _todayindex
&& _indexquarteryear >= _todayindex - 2, "Current Engagement",
_indexquarteryear <= _todayindex - 3
&& _indexquarteryear >= _todayindex - 5, "Initial Interactions",
_indexquarteryear <= _todayindex - 6, "Purchased",
_indexquarteryear > _todayindex, "Future ML prediction",
"Check again"
)
Group Quarter-Year sort =
VAR _today =
TODAY ()
VAR _indexquarteryear =
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
VAR _todayindex =
MAXX (
FILTER (
ADDCOLUMNS (
calendar_dim,
"@indexquarteryear",
ROWNUMBER (
VALUES ( calendar_dim[End of Quarter] ),
ORDERBY ( calendar_dim[End of Quarter], ASC )
)
),
calendar_dim[date] = _today
),
[@indexquarteryear]
)
RETURN
SWITCH (
TRUE (),
_indexquarteryear <= _todayindex
&& _indexquarteryear >= _todayindex - 2, 0,
_indexquarteryear <= _todayindex - 3
&& _indexquarteryear >= _todayindex - 5, -1,
_indexquarteryear <= _todayindex - 6, -2,
_indexquarteryear > _todayindex, 1,
100
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi @powerbiexpert22 ,
In what way do you want the label to grouped? For example, for initial purchase which has two quarters, there is just a single label?
Proud to be a Super User!
Hi @danextian , sorry i should not use the word group however this is what i wanted to acheive
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
82 | |
64 | |
58 |
User | Count |
---|---|
248 | |
123 | |
112 | |
79 | |
78 |