Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
norway84
Frequent Visitor

Showing date, month, quarter and year on columns and measures on rows

Hi,

 

I guess this is a common thing which has been answered many times before but I'm not able to find an solution (probably because I don't know what to search for) so I'm very glad if somebody could point me to right directon.

 

I want to make an table as illustrated below. On the rows I want different measures and on the colums I want to see the value of the measures on the date, month, quarter and year level. I know how to write a measure showing month to date, quarter to date and year to date but I don't understand how I'm then able to get the measures formatted as illustrated below.

image.png

 I have a date table in my model as shown below.

 

image.png

 

1 ACCEPTED SOLUTION
norway84
Frequent Visitor

I was a litte too fixated on having my date hierchy on the columns so I didn't realize it was a fairly easy solution using switch. 

 

1. I made a new table with one column named ReportPeriod containing the values Year, Quarter, Month, Week and Day 

 

2. Made a dynamic measure based on the value of ReportPeriod

 

E.g:

 

SalesReport =
IF (
HASONEVALUE ( ReportPeriod[Period] );
SWITCH (
VALUES ( ReportPeriod[Period] );
"Year"; [SalesYear];
"Quarter"; [SalesQuarter];
"Month"; [SalesMonth];
"Week"; [SalesWeek];
"Day"; [Sales];
BLANK ()
);
BLANK ()
)

View solution in original post

1 REPLY 1
norway84
Frequent Visitor

I was a litte too fixated on having my date hierchy on the columns so I didn't realize it was a fairly easy solution using switch. 

 

1. I made a new table with one column named ReportPeriod containing the values Year, Quarter, Month, Week and Day 

 

2. Made a dynamic measure based on the value of ReportPeriod

 

E.g:

 

SalesReport =
IF (
HASONEVALUE ( ReportPeriod[Period] );
SWITCH (
VALUES ( ReportPeriod[Period] );
"Year"; [SalesYear];
"Quarter"; [SalesQuarter];
"Month"; [SalesMonth];
"Week"; [SalesWeek];
"Day"; [Sales];
BLANK ()
);
BLANK ()
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.